Saves you making real functions for tiny little functions – handy.
timer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent){trace("inline function")});
To remove it, it can only be done when it is called (see the dudes link below for the source for this!)
myButton_btn.addEventListener(MouseEvent.CLICK, function(e:Event) { trace(e.currentTarget.name+" was just clicked!"); //removing anonymous listener e.currentTarget.removeEventListener(e.type, arguments.callee); });
src: (ty!): http://sierakowski.eu/list-of-tips/61-using-an-anonymous-inline-function-when-adding-an-event-listener.html
Tech Reference: AS3
Leave a Reply