Packageimpression.players
Classpublic class BasePlayer
InheritanceBasePlayer Inheritance flash.events.EventDispatcher
Subclasses AudioSequencer, CommandSequencer, MatchingPlayer, MenuPlayer, MultipleChoicePlayer, MultipleSelectPlayer, RenderingPlayer, SimulationPlayer, TimeSequencer

The BasePlayer class supports the display of storyboards that do not require a rendering surface or student interaction. It is also the base class for all other players.

Examples of storyboard types that use the BasePlayer class for display include the title, summary, and placeholder types. The BasePlayer is a face-based player; all display is handled by the face—a shell-specific display object created to support a given storyboard type.



Public Properties
 PropertyDefined By
  alwaysCheckComplete : Boolean
Specifies how the object should handle storyboard completion.
BasePlayer
  narrationComplete : Boolean
Indicates whether narration has finished playing.
BasePlayer
  storyboard : Storyboard
Specifies the storyboard for the player.
BasePlayer
Public Methods
 MethodDefined By
  
Creates a new instance of the BasePlayer.
BasePlayer
  
Causes the player to examine the completion criteria for the current storyboard.
BasePlayer
  
[static] Creates a string describing the state of the storyboard.
BasePlayer
  
[static] Removes all properties set by the player.
BasePlayer
  
setStoryboardState(sb:Storyboard, state:String):void
[static] Modifies the storyboard to match the described state passed.
BasePlayer
Protected Methods
 MethodDefined By
  
Initializes the storyboard.
BasePlayer
  
Loads the storyboard.
BasePlayer
  
Removes known completion criteria from the CompleteRemaining storyboard persisted property.
BasePlayer
  
Performs cleanup actions when a storyboard is unloaded.
BasePlayer
Events
 Event Summary Defined By
  Dispatched when the BasePlayer needs to resolve completion criteria beyond those defined for the class.BasePlayer
  Dispatched when a storyboard is marked as complete.BasePlayer
  Dispatched after a storyboard is initialized.BasePlayer
  Dispatched when storyboard loading is complete.BasePlayer
  Dispatched when a storyboard is loaded, but before any processing occurs.BasePlayer
  Dispatched before a storyboard is unloaded.BasePlayer
Property Detail
alwaysCheckCompleteproperty
alwaysCheckComplete:Boolean

Specifies how the object should handle storyboard completion.

If this property value is true, the value of the CompleteRemaining persisted property is set to the value of the CompleteWhen persisted property each time the storyboard is loaded. In addition, any interim completion flags are removed. This causes the checkForComplete() method to perform normal processing of the storyboard's completion criteria. When all criteria have been met, the method will then dispatch the complete event, regardless of the value of the complete persisted property.

If this property value is false, the value of the CompleteRemaining persisted property is set only on initialization and the complete event will be dispatched only if the Complete persisted property value was previously false.

Regardless of the value of this property, the complete event will only be dispatched once while the storyboard is loaded by the player.

The default value is false.


Implementation
    public function get alwaysCheckComplete():Boolean
    public function set alwaysCheckComplete(value:Boolean):void

See also

narrationCompleteproperty 
narrationComplete:Boolean

Indicates whether narration has finished playing.

If storyboard is null, the value is true. If storyboard is not null, and this value is set to true, the checkForComplete() method is invoked. Note that it is the responsibility of the shell to play any narration or audio files associated with the storyboard, and to determine when this property should be set.


Implementation
    public function get narrationComplete():Boolean
    public function set narrationComplete(value:Boolean):void

See also

storyboardproperty 
storyboard:Storyboard

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. If the value of the new storyboard's Initialized persisted property is false, the storyboard is initialized and the StoryboardEvent.INITIALIZE event is dispatched.
  4. The StoryboardEvent.LOAD_COMPLETE event is dispatched.
  5. The checkForComplete() method is invoked. If all completion criteria have been met, the StoryboardEvent.COMPLETE event is dispatched.


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

See also

Constructor Detail
BasePlayer()Constructor
public function BasePlayer()

Creates a new instance of the BasePlayer.

Method Detail
checkForComplete()method
public function checkForComplete():void

Causes the player to examine the completion criteria for the current storyboard.

If the current storyboard is null, invoking this method has no effect.

The method begins by removing known satisfied completion criteria from the completeRemaining persisted property. Once known satisified criteria are removed, ff the persisted property is not empty (""), the CheckForCompleteEvent.CHECK_FOR_COMPLETE event is dispatched, and the property takes the event's completeRemaining property value.

If the completeRemaining property value is empty after the event returns, and the Complete persisted property value is to false or the alwaysCheckComplete property value is true, the Complete persisted property value is set to true and the StoryboardEvent.COMPLETE event is dispatched.

If the alwaysCheckComplete property value is false, and the Complete persisted property value is true, no additional processing will occur after the CheckForCompleteEvent.CHECK_FOR_COMPLETE event is dispatched, and the complete event will not occur.

See also

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

Creates a string describing the state of the storyboard.

This method returns a single character to describe the state of the storyboard. If the storyboard is marked complete, "c" is returned. If the storyboard has been initialized, but is not marked complete, "i" is returned. Otherwise "." is returned.

Note that this string only describes the state that the player is aware of. If the shell stores additional data in the storyboard, it is the shell's responsibility to store the additional data if it is needed.

Parameters

sb:Storyboard — The storyboard to describe the state of.

Returns
String — The state of the storyboard.
initializeStoryboard()method 
protected function initializeStoryboard():void

Initializes the storyboard.

This method is invoked by the storyboard property set method when a non-null storyboard object is loaded and its Initialized persisted property value is false. The storyboard property set method will dispatch the initialized event after invoking this method.

The BasePlayer initializes a storyboard by setting the following properties:

Storyboard PropertyValue
CompleteRemainingSet to the value of the CompleteWhen persisted property.
InitializedSet to true.

Descendant classes override this method to perform additional type-specific initialization.

loadStoryboard()method 
protected function loadStoryboard():void

Loads the storyboard.

This method is invoked by the storyboard property set method when a non-null storyboard object is loaded after initialization (if needed) occurs. For the BasePlayer, this method performs the interim completion cleanup required if the alwaysCheckComplete property value is true and resets the internal flag indicating whether the complete event has been dispatched.

Descendant classes override this method to perform additional load-related actions.

removeCompleteRemainingCriteria()method 
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.

The BasePlayer will remove the following substrings from the completeRemaining persisted property:

SubstringMeaning
always;No specific criteria defined.
storyboardCommandsComplete;Each ChildElement object in the storyboard's Commands property has its Complete persisted property set to true.
narrationComplete;The storyboard's NarrationComplete persisted property has been set to true. Note that the shell is responsible for setting this value, either directly or indirectly via the narrationComplete player property.

Descendant classes override this method to remove additional storyboard type-specific completion criteria.

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.

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

Modifies the storyboard to match the described state passed.

If the value of state is "c" (indicating a completed storyboard), interim completion criteria will be marked as complete in addition to the overall storyboard state.

State values created using a function other than getStoryboardState may not work.

Parameters

sb:Storyboard — The Storyboard object to modify.
 
state:String — A String created using the getStoryboardState() method containing the state to restore.

See also

unloadStoryboard()method 
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. For the BasePlayer, this method removes the internal reference to the old storyboard.

Descendant classes override this method to perform additional storyboard cleanup.

Event Detail
checkForComplete Event
Event Object Type: impression.events.CheckForCompleteEvent
CheckForCompleteEvent.type property = impression.events.CheckForCompleteEvent.CHECK_FOR_COMPLETE

Dispatched when the BasePlayer needs to resolve completion criteria beyond those defined for the class.

When the checkForComplete method is invoked (either directly or indirectly as a result of setting the storyboard property), the player will first attempt to remove all known completion criteria from the CompleteRemaining persisted property. If all known criteria have been removed, and the persisted property value is not the empty string (""), this event will be dispatched to allow the shell the opportunity to remove the remaining criteria.

The CheckForCompleteEvent.CHECK_FOR_COMPLETE constant defines the value of the type property of a check for complete 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.
completeWhenThe completion criteria required for the storyboard.
completeRemainingThe completion criteria not yet met by the storyboard.
complete Event  
Event Object Type: impression.events.StoryboardEvent
StoryboardEvent.type property = impression.events.StoryboardEvent.COMPLETE

Dispatched when a storyboard is marked as complete.

The player marks a storyboard complete by setting the storyboard's Complete persisted property to true. This occurs when the checkForComplete() method is invoked and the value of the CompleteRemaining persisted property is the empty string ("").

If the alwaysCheckComplete property value is true, this event will occur when the completion criteria have been removed, even if the storyboard was previously marked complete. If the property value is false, this event will only occur the first time the storyboard is marked complete.

The StoryboardEvent.COMPLETE constant defines the value of the type property of a complete 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.
initialize Event  
Event Object Type: impression.events.StoryboardEvent
StoryboardEvent.type property = impression.events.StoryboardEvent.INITIALIZE

Dispatched after a storyboard is initialized.

This event is dispatched after the storyboard has been passed to the player. If the storyboard is null, or the storyboard's Initialized persisted property is true, initialization does not take place, and this event will not occur.

The StoryboardEvent.INITIALIZE constant defines the value of the type property of a initialize 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.
loadComplete Event  
Event Object Type: impression.events.StoryboardEvent
StoryboardEvent.type property = impression.events.StoryboardEvent.LOAD_COMPLETE

Dispatched when storyboard loading is complete.

This event is dispatched after the storyboard has been passed to the player, and after initialization and storyboard processing occurs. Unlike the StoryboardEvent.INITIALIZE event, the StoryboardEvent.LOAD_COMPLETE event occurs every time the storyboard is loaded. If the current storyboard is set to null, this event will not occur.

For face-based players, this event occurs before the storyboard property set method finishes executing. For rendering players, this event will occur when storyboard processing is complete and all external assets have finished loading.

Regardless of when this event is dispatched, the player will invoke the checkForComplete() method when the event returns to the player.

The StoryboardEvent.LOAD_COMPLETE constant defines the value of the type property of a load 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.
loadStart Event  
Event Object Type: impression.events.StoryboardEvent
StoryboardEvent.type property = impression.events.StoryboardEvent.LOAD_START

Dispatched when a storyboard is loaded, but before any processing occurs.

This event is dispatched after the storyboard has been passed to the player, but before any processing occurs. At this point, the player does not maintain a reference to the storyboard. If the passed storyboard is null, this event will not occur.

This event occurs after any unload processing the player may have performed on the previously loaded storyboard.

The StoryboardEvent.LOAD_START constant defines the value of the type property of an load start event object. This event has the following properties:
PropertyValue
bubblesfalse
cancelabletrue; canceling this event object stops the load operation.
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.
unload Event  
Event Object Type: impression.events.StoryboardEvent
StoryboardEvent.type property = impression.events.StoryboardEvent.UNLOAD

Dispatched before a storyboard is unloaded.

This event is dispatched after a new storyboard has been passed to the player, but before the new storyboard is associated with the storyboard. If the current (old) storyboard is null, this event will not occur.

This event occurs before any unload processing the player may perform on the current storyboard.

The StoryboardEvent.UNLOAD constant defines the value of the type property of an unload event object. This event has the following properties:
PropertyValue
bubblesfalse
cancelabletrue; canceling this event object stops the unload operation.
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.