Packageorg.flixel.system
Classpublic class FlxReplay
InheritanceFlxReplay Inheritance Object

The replay object both records and replays game recordings, as well as handle saving and loading replays to and from files. Gameplay recordings are essentially a list of keyboard and mouse inputs, but since Flixel is fairly deterministic, we can use these to play back recordings of gameplay with a decent amount of fidelity.



Public Properties
 PropertyDefined By
  finished : Boolean
Whether the replay has finished playing or not.
FlxReplay
  frame : int
The current frame for this recording.
FlxReplay
  frameCount : int
The number of frames in this recording.
FlxReplay
  seed : Number
The random number generator seed value for this recording.
FlxReplay
Protected Properties
 PropertyDefined By
  _capacity : int
Internal tracker for max number of frames we can fit before growing the _frames again.
FlxReplay
  _frames : Array
Internal container for all the frames in this replay.
FlxReplay
  _marker : int
Internal helper variable for keeping track of where we are in _frames during recording or replay.
FlxReplay
Public Methods
 MethodDefined By
  
Instantiate a new replay object.
FlxReplay
  
create(Seed:Number):void
Create a new gameplay recording.
FlxReplay
  
destroy():void
Clean up memory.
FlxReplay
  
load(FileContents:String):void
Load replay data from a String object.
FlxReplay
  
Get the current frame record data and load it into the input managers.
FlxReplay
  
Get the current input data from the input managers and store it in a new frame record.
FlxReplay
  
rewind():void
Reset the replay back to the first frame.
FlxReplay
  
save():String
Save the current recording data off to a String object.
FlxReplay
Protected Methods
 MethodDefined By
  
init():void
Common initialization terms used by both create() and load() to set up the replay object.
FlxReplay
Property Detail
_capacityproperty
protected var _capacity:int

Internal tracker for max number of frames we can fit before growing the _frames again.

_framesproperty 
protected var _frames:Array

Internal container for all the frames in this replay.

_markerproperty 
protected var _marker:int

Internal helper variable for keeping track of where we are in _frames during recording or replay.

finishedproperty 
public var finished:Boolean

Whether the replay has finished playing or not.

frameproperty 
public var frame:int

The current frame for this recording.

frameCountproperty 
public var frameCount:int

The number of frames in this recording.

seedproperty 
public var seed:Number

The random number generator seed value for this recording.

Constructor Detail
FlxReplay()Constructor
public function FlxReplay()

Instantiate a new replay object. Doesn't actually do much until you call create() or load().

Method Detail
create()method
public function create(Seed:Number):void

Create a new gameplay recording. Requires the current random number generator seed.

Parameters

Seed:Number — The current seed from the random number generator.

destroy()method 
public function destroy():void

Clean up memory.

init()method 
protected function init():void

Common initialization terms used by both create() and load() to set up the replay object.

load()method 
public function load(FileContents:String):void

Load replay data from a String object. Strings can come from embedded assets or external files loaded through the debugger overlay.

Parameters

FileContents:String — A String object containing a gameplay recording.

playNextFrame()method 
public function playNextFrame():void

Get the current frame record data and load it into the input managers.

recordFrame()method 
public function recordFrame():void

Get the current input data from the input managers and store it in a new frame record.

rewind()method 
public function rewind():void

Reset the replay back to the first frame.

save()method 
public function save():String

Save the current recording data off to a String object. Basically goes through and calls FrameRecord.save() on each frame in the replay. return The gameplay recording in simple ASCII format.

Returns
String