Connecting Tech Pros Worldwide Help | Site Map

Mouse over action for a item in a list box

Member
 
Join Date: Aug 2008
Posts: 41
#1: Jul 10 '09
Hi guys , just a quick one, if anyone knows

I have a listbox that contains some items .
Is there mouse over action for that when i go over the item from that listbox to do something?

Thanks.
Newbie
 
Join Date: Aug 2009
Posts: 6
#2: Aug 10 '09

re: Mouse over action for a item in a list box


Which version of actionscript are you using?

I think this should work:

Quote:
on (rollOver) {
I don't have flash any more so I havn't tested it.
gopan's Avatar
Member
 
Join Date: Apr 2009
Location: Kochi (COK), India
Posts: 41
#3: Aug 14 '09

re: Mouse over action for a item in a list box


If you have a list named ccList then you can have the roll over and roll out functions as this in AS2

Expand|Select|Wrap|Line Numbers
  1. var listenerObj:Object = new Object();
  2. listenerObj.itemRollOver = function(eventObj:Object) {
  3.     trace("Roll Over");
  4. };
  5. listenerObj.itemRollOut = function(eventObj:Object) {
  6.     trace("Roll Out");
  7. };
  8. ccList.addEventListener("itemRollOver", listenerObj);
  9. ccList.addEventListener("itemRollOut", listenerObj);
  10.  
and in AS3

Expand|Select|Wrap|Line Numbers
  1. import fl.events.ListEvent;
  2.  
  3. function rollout_fn(e:ListEvent):void{
  4.     trace("Roll Out");
  5. }
  6.  
  7. function rollover_fn(e:ListEvent):void{
  8.     trace("Roll Over");
  9. }
  10.  
  11. ccList.addEventListener(ListEvent.ITEM_ROLL_OUT, rollout_fn);
  12. ccList.addEventListener(ListEvent.ITEM_ROLL_OVER, rollout_fn);
  13.  
Reply