Skip to content

Instantly share code, notes, and snippets.

@robertpenner
Created November 26, 2009 19:49
Show Gist options
  • Save robertpenner/243630 to your computer and use it in GitHub Desktop.
Save robertpenner/243630 to your computer and use it in GitHub Desktop.
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