Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
EnterFrameDispatcher using timeline to avoid Event creation
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
You can’t perform that action at this time.