Skip to content

Instantly share code, notes, and snippets.

@amacdougall
Created July 12, 2011 17:48
Show Gist options
  • Save amacdougall/1078525 to your computer and use it in GitHub Desktop.
Save amacdougall/1078525 to your computer and use it in GitHub Desktop.
Self-cleaning anonymous function
sprite.addEventListener(Event.ENTER_FRAME, function handleFrame(event:Event):void {
sprite.addEventListener(Event.REMOVED_FROM_STAGE, function(event:Event):void {
sprite.removeEventListener(Event.ENTER_FRAME, handleFrame);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment