Hi, Perhaps you're storing a reference to the button in buttonsArray?
In that case, you should do: buttonsArray.indexOf(e.target); Cheers Juan Pablo Califano 2009/6/16, Isaac Alves <[email protected]>: > > Hi fellows, > Cannot solve this problem: > > function buttonClicked(e:Event):void { > trace (buttonsArray.indexOf(e.target.name)); > > It always traces "-1". This code should trace the index of the Array > element right? for ex: 0, 1, 2 or 3. > > If i do this, it will trace the correct name of the element. > > function buttonClicked(e:Event):void { > trace (e.target.name); > > If I do this, it will trace the name of the second element: > > function buttonClicked(e:Event):void { > trace (buttonsArray[1].name); > > Why indexOf doesn´t work properly? > > Thanks a lot! > _______________________________________________ > Flashcoders mailing list > [email protected] > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

