Tuesday, September 11, 2007

AS3 quips

 

AS3:

 

e.currentTarget

When you add an event listener, and then do something like this:

function listen(e:Event){

e.target.x+=5;

}

 

That could actually screw you up. For some dumb reason e.target doesn’t actually always return the target movie clip. ?!?! I don’t understand you, Adobe.

The correct way is of course e.currentTaret.x+=5;

 

getChildIndex()

Weirdly enough, you cant just do

getChildIndex(e.currentTarget);

 

You have to do… (deep breath)

e.currentTarget.parent.getChildIndex(DisplayObject(e.currentTarget))

 

 

Posted by johnfn in 00:10:22
Comments

Leave a Reply