I have this Array and these event handlers:
var btnArr:Array = new Array(aBtn, bBtn, cBtn);
aBtn.addEventListener(MouseEvent.MOUSE_OVER, blah);
bBtn.addEventListener(MouseEvent.MOUSE_OVER, blah);
cBtn.addEventListener(MouseEvent.MOUSE_OVER, blah);
Where aBtn, bBtn and cBtn are MovieClip objects.
When I try and get the index of one of these, during an event:
function blah(e:Event) {
var i = btnArr.indexOf(e.target);
trace(i)
So why does this trace return an undefined every time?
Use e.currentTarget , e.target may be some child . Or like Tobias says – set mouseChildren to false