Created
September 24, 2011 20:37
-
-
Save jacksonkr/1239830 to your computer and use it in GitHub Desktop.
AS3 Frame Change (by label) Listener
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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