Package | impression.players |
Class | public class SimulationPlayer |
Inheritance | SimulationPlayer ![]() ![]() |
The Impression simulation framework provides a flexible, robust mechanism for defining simulation objects and managing student interaction with these objects. The SimulationPlayer uses program-specific objects (using interfaces defined in the impression.simulation namespace) to control simulation state and monitor and control interactions. The samples included with the AS3 Base Class Framework illustrate just one way of many to create and use these objects to provide a rich, interactive simulation environment for learning.
Property | Defined By | ||
---|---|---|---|
additionalActionsComplete : Boolean
Indicates whether additional, non-simulation state actions have been completed. | SimulationPlayer | ||
alwaysCheckComplete : Boolean [override]
Specifies how the object should handle storyboard completion. | SimulationPlayer | ||
loading : Boolean [read-only]
Indicates whether the current storyboard is loading. | SimulationPlayer | ||
![]() | narrationComplete : Boolean
Indicates whether narration has finished playing. | BasePlayer | |
remediationCount : Number
The number of times that a remediation event has occurred for the current storyboard. | SimulationPlayer | ||
resolver : AssetResolver
The AssetResolver to use to request external assets. | SimulationPlayer | ||
rulesEngine : IRulesEngine
The simulation rules engine. | SimulationPlayer | ||
sequencer : ISequencer
The simulation sequencer. | SimulationPlayer | ||
simulation : ISimulation
The simulation process. | SimulationPlayer | ||
simulationUI : ISimulationUI
The simulation user interface. | SimulationPlayer | ||
snapshotLoader : ISnapshotLoader
The simulation snapshot loader. | SimulationPlayer | ||
storyboard : Storyboard [override]
Specifies the storyboard for the player. | SimulationPlayer |
Method | Defined By | ||
---|---|---|---|
SimulationPlayer(sim:ISimulation = null, simUI:ISimulationUI = null, snapshotLoader:ISnapshotLoader = null, sequencer:ISequencer = null, rulesEngine:IRulesEngine = null, resolver:AssetResolver = null)
Creates a new instance of the SimulationPlayer. | SimulationPlayer | ||
checkForComplete():void [override]
Causes the player to examine the completion criteria for the current storyboard. | SimulationPlayer | ||
getStoryboardState(sb:Storyboard):String [static]
Creates a string describing the state of the storyboard. | SimulationPlayer | ||
requestDataChange(changeData:Object):Boolean
Processes a request for a change to the simulation data. | SimulationPlayer | ||
resetStoryboard(sb:Storyboard):void [static]
Removes all properties set by the player. | SimulationPlayer | ||
setStoryboardState(sb:Storyboard, state:String):void [static]
Modifies the storyboard to match the described state passed. | SimulationPlayer |
Method | Defined By | ||
---|---|---|---|
![]() | initializeStoryboard():void
Initializes the storyboard. | BasePlayer | |
loadStoryboard():void [override]
Loads the storyboard. | SimulationPlayer | ||
[override]
Removes known completion criteria from the CompleteRemaining storyboard persisted property. | SimulationPlayer | ||
unloadStoryboard():void [override]
Performs cleanup actions when a storyboard is unloaded. | SimulationPlayer |
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 when the snapshot loader begins to load external assets. | SimulationPlayer | |||
Dispatched when all external assets have finished loading. | SimulationPlayer | |||
Dispatched when the rules engine approves a data change request. | SimulationPlayer | |||
![]() | 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 when the rules engine determines that remediation should occur. | SimulationPlayer | |||
Dispatched when an simulation-related object dispatches an error event. | SimulationPlayer | |||
![]() | Dispatched before a storyboard is unloaded. | BasePlayer |
additionalActionsComplete | property |
additionalActionsComplete:Boolean
Indicates whether additional, non-simulation state actions have been completed.
If the storyboard
property value is null
, false
is returned.
This method sets or returns the value of the current storyboard's additionalActionsComplete
persisted property.
public function get additionalActionsComplete():Boolean
public function set additionalActionsComplete(value:Boolean):void
alwaysCheckComplete | property |
alwaysCheckComplete:Boolean
[override] 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.
Note that the SimulationPlayer default value for this
property is true
.
The default value is true
.
public function get alwaysCheckComplete():Boolean
public function set alwaysCheckComplete(value:Boolean):void
See also
loading | property |
loading:Boolean
[read-only] Indicates whether the current storyboard is loading.
public function get loading():Boolean
remediationCount | property |
remediationCount:Number
The number of times that a remediation event has occurred for the current storyboard.
If the storyboard
property value is null
, -1
is returned. Note that
this number can be changed by the shell when the player dispatches a RemediationRequestEvent.REMEDIATION_REQUEST
event. This method sets or returns the value of the current storyboard's RemediationCount
persisted property.
public function get remediationCount():Number
public function set remediationCount(value:Number):void
See also
resolver | property |
resolver:AssetResolver
The AssetResolver to use to request external assets.
The resolver is not used directly by the SimulationPlayer, rather, it is passed to the snapshotLoader as needed.
public function get resolver():AssetResolver
public function set resolver(value:AssetResolver):void
See also
rulesEngine | property |
rulesEngine:IRulesEngine
The simulation rules engine.
public function get rulesEngine():IRulesEngine
public function set rulesEngine(value:IRulesEngine):void
sequencer | property |
sequencer:ISequencer
The simulation sequencer.
public function get sequencer():ISequencer
public function set sequencer(value:ISequencer):void
simulation | property |
simulation:ISimulation
The simulation process.
public function get simulation():ISimulation
public function set simulation(value:ISimulation):void
simulationUI | property |
simulationUI:ISimulationUI
The simulation user interface.
public function get simulationUI():ISimulationUI
public function set simulationUI(value:ISimulationUI):void
snapshotLoader | property |
snapshotLoader:ISnapshotLoader
The simulation snapshot loader.
public function get snapshotLoader():ISnapshotLoader
public function set snapshotLoader(value:ISnapshotLoader):void
storyboard | property |
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:
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.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
. Initialized
persisted property is false
, the storyboard is initialized and the StoryboardEvent.INITIALIZE
event is dispatched.loadStoryboard()
protected method is invoked. public function get storyboard():Storyboard
public function set storyboard(value:Storyboard):void
See also
SimulationPlayer | () | Constructor |
public function SimulationPlayer(sim:ISimulation = null, simUI:ISimulationUI = null, snapshotLoader:ISnapshotLoader = null, sequencer:ISequencer = null, rulesEngine:IRulesEngine = null, resolver:AssetResolver = null)
Creates a new instance of the SimulationPlayer.
Parameterssim:ISimulation (default = null ) — The simulation process.
| |
simUI:ISimulationUI (default = null ) — The simulation user interface.
| |
snapshotLoader:ISnapshotLoader (default = null ) — The simulation snapshot loader.
| |
sequencer:ISequencer (default = null ) — The simulation sequencer.
| |
rulesEngine:IRulesEngine (default = null ) — The simulation rules engine.
| |
resolver:AssetResolver (default = null ) — The AssetResolver to use to request external assets.
|
checkForComplete | () | method |
override 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. If the current storyboard is still loading (the loading
property value
is true
, 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.
|
String — The state of the storyboard.
|
loadStoryboard | () | method |
override 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.
When loading a storyboard, the RenderingPlayer performs the following actions:
alwaysCheckComplete
property value is true
, the additionalActionsComplete
storyboard persisted property value is removed.loading
property value is set to true
.snapshotLoader
property value is not null
, and the Snapshot
storyboard persisted property value exists and has a non-empty filename,
the following actions occur, in order:
resolver
property value is not null
, the resolver's beginOwnerTransaction()
method is invoked.loadSnapshot()
method is invoked.endOwnerTransaction()
method is invoked (if the resolver is not null
.impression.events.StoryboardEvent.CONTENT_LOAD_BEGIN
and impression.events.StoryboardEvent.CONTENT_LOAD_END
events
will be dispatched by the player when the snapshot loader begins and finishes loading content. Further processing will not occur until the
snapshot loader dispatches a SimulationObjectEvent.INITIALIZATION_COMPLETE
event.sequencer
property value is not null
, and the InitialSequence
storyboard persisted property value exists and is not the
empty string (""), the sequencer's sequence()
method is invoked. Further processing will not occur until the sequencer
dispatches a SimulationObjectEvent.INITIALIZATION_COMPLETE
event.rulesEngine
property value is not null
, and the Rules
storyboard persisted property value exists and is not the
empty string (""), the rules engine's initialize()
method is invoked. Further processing will not occur until the rules engine
dispatches a SimulationObjectEvent.INITIALIZATION_COMPLETE
event.loading
property value is set to false
, and the StoryboardEvent.LOAD_COMPLETE
event is dispatched.checkForComplete()
method is invoked. If all completion criteria have been met, the complete
event is dispatched.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 SimulationPlayer will remove the following substrings from the completeRemaining
persisted property:
Substring | Meaning |
---|---|
simulationStateReady; | The value of the rules engine's simulationStateReady property is true . |
additionalActionsComplete; | The value of the additionalActionsComplete property is true . |
See also
requestDataChange | () | method |
public function requestDataChange(changeData:Object):Boolean
Processes a request for a change to the simulation data.
This method is automatically invoked by the SimulationPlayer when the ISimulationUI object
referenced by the simulationUI
property value dispatches a
SimulationDataChangeRequestEvent.DATA_CHANGE_REQUEST
event.
If the simulation
property value is null
, invoking this method
has no effect and returns false
. If the rulesEngine
property value
is null
, and the simulation object's ownerSetsData
property
value is true
, invoking this method has no effect and returns true
. If the
rulesEngine
property value is null
, and the simulation object's
ownerSetsData
property value is false
, this method passes the changeData
parameter to the simulation object's setData
method and returns true
.
If the rulesEngine
property value is not null
, the simulation
property value and the changeData
parameter value are passed to the rules engine's
evaluateChangeRequest()
method. If the method returns true
, and the simulation
object's ownerSetsData
property value is false
, the simulation object's
setData
method is invoked with the changeData
parameter. Regardless of the value
of the ownerSetsData
property value, the player will dispatch a SimulationDataChangeEvent.DATA_CHANGE_APPROVED
event if the change is approved by the rules engine. The method will return the result of the call to the
rules engine's evaluateChangeRequest()
method.
Parameters
changeData:Object — The requested change to evaluate.
|
Boolean — true if the change is approved by the rules engine, false else.
|
See also
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:
|
See also
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.
|
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 CanvasPlayer performs the following actions:
loading
property value is set to false
.cancel()
method is invoked on the snapshotLoader
property (if it is not null
).cancel()
method is invoked on the sequencer
property (if it is not null
).cancel()
method is invoked on the rulesEngine
property (if it is not null
).cancelOwnerTransaction()
method is invoked.closeAllOf()
method.See also
contentLoadBegin | Event |
impression.events.StoryboardEvent
impression.events.StoryboardEvent.CONTENT_LOAD_BEGIN
Dispatched when the snapshot loader begins to load external assets.
This event is dispatched when the resolverInfo
object whose owner
property value is the player dispatches
its beginTransaction
event.
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The object that raised the event. |
sb | The Storyboard object assigned to the target. |
contentLoadEnd | Event |
impression.events.StoryboardEvent
impression.events.StoryboardEvent.CONTENT_LOAD_END
Dispatched when all external assets have finished loading.
This event is dispatched when the resolverInfo
object whose owner
property value is the player dispatches
its endTransaction
event.
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The object that raised the event. |
sb | The Storyboard object assigned to the target. |
dataChangeApproved | Event |
impression.events.SimulationDataChangedEvent
impression.events.SimulationDataChangedEvent.DATA_CHANGE_APPROVED
Dispatched when the rules engine approves a data change request.
This event is dispatched when the requestDataChange()
method is invoked
either explicitly or implicitly as the result of the simulationUI
property
object dispatching a SimulationDataChangeRequestEvent.DATA_CHANGE_REQUEST
event.
The event is dispatched if the call to the rules engine's evaluateChangeRequest()
method returns true
.
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The object that raised the event. |
changeData | The data that has changed. |
remediationRequest | Event |
impression.events.RemediationRequestEvent
impression.events.RemediationRequestEvent.REMEDIATION_REQUEST
Dispatched when the rules engine determines that remediation should occur.
This event is dispatched by the player when the rules engine dispatches a
RulesEngineRemediationRequest.REQUEST_REMEDIATION
event. Before dispatching the
event, the SimulationPlayer will set the value of the remediationCount
property
of the event object to one more than the value of the current storyboard's remediationCount
persisted property. When the event returns, the value of the event's remediationCount
property will be stored as the current storyboard's remediationCount
persisted property.
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The object that raised the event. |
sb | The Storyboard object assigned to the target. |
message | The remediation message to display. |
remediationData | Additional remediation data. |
remediationCount | The number of times remediation requests have occurred for the storyboard. |
simulationPlayerError | Event |
impression.events.SimulationPlayerErrorEvent
impression.events.SimulationPlayerErrorEvent.ERROR
Dispatched when an simulation-related object dispatches an error event.
This event is dispatched when the simulation, simulation user interface, snapshot loader,
sequencer, or rules engine dispatches a SimulationObjectErrorEvent.ERROR
event.
This event is dispatched when the requestDataChange()
method is invoked
either explicitly or implicitly as the result of the simulationUI
property
object dispatching a SimulationDataChangeRequestEvent.DATA_CHANGE_REQUEST
event.
The event is dispatched if the call to the rules engine's evaluateChangeRequest()
method returns true
.
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The object that raised the event. |
sb | The Storyboard object assigned to the target. |
loading | Indicates whether or not the event occurred during the loading phase of the storyboard. |
message | The message associated with the error. |
errorData | Additional data associated with the error. |
source | The type of object that initially raised the error. |