array won't work actionscript 3
Posted
by steve
on Stack Overflow
See other posts from Stack Overflow
or by steve
Published on 2010-05-25T14:29:22Z
Indexed on
2010/05/25
14:31 UTC
Read the original article
Hit count: 275
actionscript-3
|array
I've tried everything. Arrays are quite simple so I don't know why this doesn't function:
var menuList:Array = [menu_bag_mc,menu_chips_mc,menu_coke_mc,menu_cup_mc,menu_deodorant_mc,menu_fork_mc,menu_knife_mc,menu_lighter_mc,menu_milk_mc,menu_pill_mc,menu_rings_mc,menu_shampoo_mc,menu_spoon_mc,menu_straw_mc,menu_toothbrush_mc,menu_trashbag_mc,menu_water_mc];
function captureAllClicks(event:MouseEvent):void
{
trace(menuList.indexOf(event.target));
}
stage.addEventListener(MouseEvent.CLICK, captureAllClicks);
Every time I click on any of the items on the stage (which are all given the instance names listed above. each is a tweening movieclip containing a button) I get a trace of -1. WHY?!
© Stack Overflow or respective owner