PDA

View Full Version : [AS3] List Component question


absolutezero3424
09-04-2007, 04:23 PM
How do you check for a List item MOUSE_OVER/ROLL_OVER event on a List Component in AS3? Is there a way? I would think so....The same could be true for a TileList Component & a DataGrid Component.

panel
09-04-2007, 04:35 PM
import fl.events.ListEvent;

myList.addEventListener(ListEvent.ITEM_ROLL_OVER, onItemRollOver);

function onItemRollOver(evt:ListEvent)
{
trace("Over")
}


Yes it will work for TileList Component & DataGrid

absolutezero3424
09-04-2007, 05:12 PM
awesome, thx!

rajesh922@hotmail.com
06-02-2011, 11:58 AM
Hi how do you do this with a Selected item??

I need this but it does not work i get this error
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at FlashMenu__r3_fla::MainTimeline/rollover_fn()[FlashMenu__r3_fla.MainTimeline::frame1:21]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at fl.controls::SelectableList/handleCellRendererMouseEvent()


import fl.events.ListEvent;

ccList.addItem({label:"AA"});
ccList.addItem({label:"bb"});
ccList.addItem({label:"cc"});
ccList.addItem({label:"dd"});
ccList.addItem({label:"ee"});

ccList.addEventListener(ListEvent.ITEM_ROLL_OUT, rollout_fn);
ccList.addEventListener(ListEvent.ITEM_ROLL_OVER, rollover_fn);

function rollout_fn(e:ListEvent):void{
test1.text="ROLLOUT"
trace("ROLLOUT")
}

function rollover_fn(e:ListEvent):void{
trace("ROLLOVER")
test1.text=e.target.selectedItem.label
}