Packageimpression.players.sequencers
Classpublic class TimeSequencer
InheritanceTimeSequencer Inheritance BasePlayer Inheritance flash.events.EventDispatcher

The TimeSequencer class supports the playback of time sequencer storybords. A time sequencer storyboard includes a set of project-specific properties, and any number of child elements. As the sequencer's internal timer runs, the TimeSequencer periodically examines each child element's position and complete persisted properties. If the position (elapsed time) of the sequencer is greater than the value of the position persisted property, and the complete persisted property value is false, the TimeSequencer will dispatch a CueEvent.CUE event to notify the shell that an action should occur.

Like all sequencer classes, the exact data and behavior is project-defined. The TimeSequencer class provides only the minimum functionality needed to perform actions synchronized with a timer.



Public Properties
 PropertyDefined By
 InheritedalwaysCheckComplete : Boolean
Specifies how the object should handle storyboard completion.
BasePlayer
  interval : Number
The frequency, in milliseconds, that the sequencer will use to check the child elements of the current storyboard.
TimeSequencer
 InheritednarrationComplete : Boolean
Indicates whether narration has finished playing.
BasePlayer
  position : Number
Returns or sets the position in the audio file.
TimeSequencer
  status : String
[read-only] The current status of the sequencer.
TimeSequencer
  storyboard : Storyboard
[override] Specifies the storyboard for the player.
TimeSequencer
  useLastPosition : Boolean
Indicates whether or not the last position should be used to begin playback of a previously loaded storyboard.
TimeSequencer
Public Methods
 MethodDefined By
  
Creates a new instance of the TimeSequencer.
TimeSequencer
 Inherited
Causes the player to examine the completion criteria for the current storyboard.
BasePlayer
  
[static]
TimeSequencer
  
pause():void
Pauses or resumes playback.
TimeSequencer
  
play():void
Begins or resumes playback.
TimeSequencer
  
[static] Removes all properties set by the player.
TimeSequencer
  
setStoryboardState(sb:Storyboard, state:String):void
[static]
TimeSequencer
  
stop():void
Stops playback and resets the position property value to 0.
TimeSequencer
Protected Methods
 MethodDefined By
 Inherited
Initializes the storyboard.
BasePlayer
  
[override] Loads the storyboard.
TimeSequencer
  
[override] Removes known completion criteria from the CompleteRemaining storyboard persisted property.
TimeSequencer
  
[override] Performs cleanup actions when a storyboard is unloaded.
TimeSequencer
Events
 Event Summary Defined By
 InheritedDispatched when the BasePlayer needs to resolve completion criteria beyond those defined for the class.BasePlayer
 InheritedDispatched when a storyboard is marked as complete.BasePlayer
  Dispatched when a sequencer element should be processed.TimeSequencer
 InheritedDispatched after a storyboard is initialized.BasePlayer
 InheritedDispatched when storyboard loading is complete.BasePlayer
 InheritedDispatched when a storyboard is loaded, but before any processing occurs.BasePlayer
  Dispatched when the status of the sequencer changes.TimeSequencer
  Dispatched when the internal timer fires.TimeSequencer
 InheritedDispatched before a storyboard is unloaded.BasePlayer
Property Detail
intervalproperty
interval:Number

The frequency, in milliseconds, that the sequencer will use to check the child elements of the current storyboard.

The default value is 100.


Implementation
    public function get interval():Number
    public function set interval(value:Number):void
positionproperty 
position:Number

Returns or sets the position in the audio file.

When this property value is set, and the status property value is SequencerStatusTypes.PLAYING, playback stops and the status is changed to SequencerStatusTypes.PAUSED. If the status property value is SequencerStatusTypes.STOPPED, SequencerStatusTypes.EOF, or SequencerStatusTypes.LOAD_COMPLETE, the status is changed to SequencerStatusTypes.PAUSED. If the status is not one of the values listed above, an error is thrown.


Implementation
    public function get position():Number
    public function set position(value:Number):void

Throws
ArgumentError — cannot set position when status is [status] (ArgumentError).
 
RangeError — position cannot be set < 0 (RangeError).
statusproperty 
status:String  [read-only]

The current status of the sequencer. This value will be one of the SequencerStatusTypes constant values.


Implementation
    public function get status():String

See also

storyboardproperty 
storyboard:Storyboard[override]

Specifies the storyboard for the player.

If null is passed, the current storyboard is unloaded, the StoryboardEvent.UNLOAD event is dispatched, and no further action occurs.

If a non- null storyboard object is passed, the following actions occur, in order:

  1. If the previously loaded storyboard is not null, the StoryboardEvent.UNLOAD event is dispatched. If the event is not cancelled, the current storyboard is unloaded. If the event is cancelled, further processing stops.
  2. The StoryboardEvent.LOAD_START event is dispatched. If the event is not cancelled, the new storyboard is associated with the player. If the event is cancelled, further processing stops and the value of this property is set to null.
  3. The StoryboardEvent.LOAD_COMPLETE event is dispatched.
  4. The checkForComplete() method is invoked. If all completion criteria have been met, the StoryboardEvent.COMPLETE event is dispatched.

Note that the TimeSequencer may raise one or move SequencerStatusEvent.STATUS_CHANGED events during storyboard load.


Implementation
    public function get storyboard():Storyboard
    public function set storyboard(value:Storyboard):void

See also

SequencerStatusTypes
BasePlayer.unload
BasePlayer.loadStart
BasePlayer.initialize
BasePlayer.loadComplete
BasePlayer.checkForComplete()
BasePlayer.complete
useLastPositionproperty 
useLastPosition:Boolean

Indicates whether or not the last position should be used to begin playback of a previously loaded storyboard.

The default value is false.


Implementation
    public function get useLastPosition():Boolean
    public function set useLastPosition(value:Boolean):void
Constructor Detail
TimeSequencer()Constructor
public function TimeSequencer()

Creates a new instance of the TimeSequencer.

Method Detail
getStoryboardState()method
public static function getStoryboardState(sb:Storyboard):String

Parameters

sb:Storyboard

Returns
String
loadStoryboard()method 
override protected function loadStoryboard():void

Loads the storyboard.

This method is invoked by the storyboard property set method. Unlike other player classes, this method is invoked even if a null storyboard object is loaded. This method is invoked after initialization (if needed) occurs.

When loading a storyboard, the TimeSequencer performs the following actions:

See also

BasePlayer.loadStoryboard()
SequencerStatusTypes
pause()method 
public function pause():void

Pauses or resumes playback.

If the status property value is SequencerStatusTypes.PAUSED, this method resumes playback from the value of position. If the status property value is SequencerStatusTypes.PLAYING, this method pauses playback. For all other status property values, invoking this method has no effect.

If this method pauses playback, the player will dispatch the SequencerStatusEvent.STATUS_CHANGE event.

See also

play()method 
public function play():void

Begins or resumes playback.

If the status property value is SequencerStatusTypes.PAUSED, this method resumes playback from the value of position. If the status property value is one of the following, this method resets the position to 0 and begins playback.

For all other status property values, invoking this method has no effect.

If this method begins playback, the player will dispatch the SequencerStatusEvent.STATUS_CHANGE event.

See also

removeCompleteRemainingCriteria()method 
override protected function removeCompleteRemainingCriteria():void

Removes known completion criteria from the CompleteRemaining storyboard persisted property.

This method is invoked by the checkForComplete() method if the value of the storyboard property is not null, and the complete event has not been dispatched since the storyboard was loaded.

In addition to the substrings processed by the BasePlayer, the AudioSequencer will remove the following substrings from the completeRemaining persisted property:

SubstringMeaning
commandObjectsComplete;All child elements have a Complete persisted property value of true.

See also

BasePlayer.removeCompleteRemainingCriteria()
resetStoryboard()method 
public static function resetStoryboard(sb:Storyboard):void

Removes all properties set by the player.

Note that this method also removes interim completion properties used by the player, but not necessarily set by the player.

Parameters

sb:Storyboard — The storyboard to remove properties from.

This method removes the following properties from a storyboard:

  • Initialized
  • CompleteRemaining
  • Complete
  • NarrationComplete
  • The Complete property of each ChildElement object in the storyboard's Commands ChildElementCollection property, if it exists.
  • LastPosition

This method removes the following properties from each ChildElement in the storyboard's children collection:

  • Complete

setStoryboardState()method 
public static function setStoryboardState(sb:Storyboard, state:String):void

Parameters

sb:Storyboard
 
state:String

stop()method 
public function stop():void

Stops playback and resets the position property value to 0.

unloadStoryboard()method 
override protected function unloadStoryboard():void

Performs cleanup actions when a storyboard is unloaded.

This method is invoked by the storyboard property set method when the current value of the property is not null and the unload event has not been cancelled.

When unloading a storyboard, the TimeSequencer performs the following actions:

See also

BasePlayer.unloadStoryboard()
Event Detail
cue Event
Event Object Type: impression.events.CueEvent
CueEvent.type property = impression.events.CueEvent.CUE

Dispatched when a sequencer element should be processed.

This event is dispatched when the sequencer's status property is SequencerStatusTypes.PLAYING and a child element object's Position persisted property value is <= the value of the sequencer's position property value and the element's Complete persisted property value is false. A CueEvent.CUE event is dispatched for each child element that meets this criteria.

Note that the child elements in the storyboard's children collection are sorted by the value of their Position persisted property value each time the storyboard is loaded; this ensures that the cue events occur "in order".

The CueEvent.CUE constant defines the value of the type property of an cue event object. This event has the following properties:
PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
currentTargetThe object that is actively processing the Event object with an event listener.
targetThe object that raised the event.
sbThe Storyboard object assigned to the target.
currentPositionThe value of the position property of the ChildElement object that triggered the event.
childElementThe ChildElement object that triggered the event.
completeIndicates whether or not the childElement parameter's complete persisted property should be set to true when the event returns.
sequencerStatusChanged Event  
Event Object Type: impression.events.SequencerStatusEvent
SequencerStatusEvent.type property = impression.events.SequencerStatusEvent.STATUS_CHANGED

Dispatched when the status of the sequencer changes.

The SequencerStatusEvent.STATUS_CHANGED constant defines the value of the type property of a status changed event object. This event has the following properties:
PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
currentTargetThe object that is actively processing the Event object with an event listener.
targetThe object that raised the event.
sbThe Storyboard object assigned to the target.
statusThe status of the sequencer.
textAdditional information about the status.
timer Event  
Event Object Type: flash.events.TimerEvent
TimerEvent.type property = flash.events.TimerEvent.TIMER

Dispatched when the internal timer fires. This event is dispatched when the sequencer's status property is SequencerStatusTypes.PLAYING, before any CueEvent.CUE events are dispatched.