Skip to content

Instantly share code, notes, and snippets.

@jacksonkr
Created September 24, 2011 20:37
Show Gist options
  • Save jacksonkr/1239830 to your computer and use it in GitHub Desktop.
Save jacksonkr/1239830 to your computer and use it in GitHub Desktop.
AS3 Frame Change (by label) Listener
import flash.events.Event;
var _lastFrame:String = this.currentLabel;
function enterFrameHandler(event:Event):void {
if(this.currentLabel != _lastFrame) {
_lastFrame = this.currentLabel; // set this equal to this.currentFrame to listen for any frame changes instead.
dispatchEvent(new Event(Event.CHANGE));
}
}
function changeHandler(event:Event):void {
trace('the frame label changed to:' + this.currentLabel);
}
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
this.addEventListener(Event.CHANGE, changeHandler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment