Created
November 26, 2009 19:49
-
-
Save robertpenner/243630 to your computer and use it in GitHub Desktop.
EnterFrameDispatcher using timeline to avoid Event creation
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
package | |
{ | |
import flash.display.MovieClip; | |
import org.osflash.signals.Signal; | |
/** | |
* This class needs to be associated with a movie clip symbol containing two blank frames on its timeline. | |
* Usage: | |
* | |
* var dispatcher:EnterFrameDispatcher = new EnterFrameDispatcher(); | |
* dispatcher.signal.add(handleEnterFrame); | |
* | |
* function handleEnterFrame():void | |
* { | |
* | |
* } | |
*/ | |
public class EnterFrameDispatcher extends MovieClip | |
{ | |
public var signal:Signal; | |
public function EnterFrameDispatcher() | |
{ | |
addFrameScript(0, frame1, 1, frame2); | |
signal = new Signal(); | |
} | |
function frame1() | |
{ | |
signal.dispatch(); | |
} | |
function frame2() | |
{ | |
signal.dispatch(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment