Wednesday, October 8, 2008

EventListener function creation shortcut

My co-worker Ian is a big Python developer. He loves all types of one liner code shortcuts. I have to say it is great working with him. I get to steal all types of neat tricks. Here is a shortcut when creating an event listener. You know it's the little things in life.

my_btn.addEventListener( MouseEvent.CLICK, function( event:MouseEvent ):void
{
trace( event.type );
} );

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.