AS3 Instant Replay

Instant Replay is a small as3 service that can be used to record and playback user interactions.

Simply register the display object that you wish to record/playback.

?View Code ACTIONSCRIPT3
InstantReplay.register(stage);

Next, when you’re ready to record interactions set the record property to true.

?View Code ACTIONSCRIPT3
InstantReplay.record = true;

Finally, call the play function to playback the recorded interactions.

?View Code ACTIONSCRIPT3
InstantReplay.play();

You’ll obviously also need to add an event listener to the display object that you’ve registered otherwise you won’t actually see anything happening.

?View Code ACTIONSCRIPT3
private var bitmap:Bitmap;
 
public function Main():void 
{
	bitmap = new Bitmap(new BitmapData(50, 50, false, 0xFF0000));
	addChild(bitmap);
 
	stage.addEventListener(MouseEvent.MOUSE_MOVE, OnMouseMove);
}
 
private function OnMouseMove(e:Event):void 
{
	bitmap.x = e.stageX;
	bitmap.y = e.stageY;
}

Example below:

Get Adobe Flash player

No description or homepage.

2 Comments

  1. Will this work with Starling as well?

  2. It wasn’t designed to work with Starling, but may well work just fine with Starling because I would think the events would be past all the way up to the starling layer.. BUt if it doesn’t work out of the box you could modify the source fairly easily.

Submit a Comment

Your email address will not be published. Required fields are marked *