Package | impression.simulation |
Interface | public interface IRulesEngine extends flash.events.IEventDispatcher |
Methods on an IRulesEngine object will be invoked by the SimulationPlayer when when a user interacts with the simulation user
interface. The object will review the the proposed simulation state changes and allow the proposed changes (potentially adding
additional changes) or reject them. The object will also receive notifications when the simulation changes state, and should notify
the SimulationPlayer by dispatching the SimulationObjectEvent.STATE_READY
event when the simulation state matches the
state specified by the rules.
Note that, although the rules are provided to the IRulesEngine object as a single String object, the specific format of the rules and the mechanisms used to evaluate user actions and the simulation state is project- and simulation- specific. The sample runtime included in the AS3 DevKit shows only one possible approach.
Property | Defined By | ||
---|---|---|---|
simulationStateReady : Boolean [read-only]
Indicates whether the simulation is in the state specified by the rules. | IRulesEngine |
Method | Defined By | ||
---|---|---|---|
cancel():void
Cancels any rules engine processing currently in progress. | IRulesEngine | ||
evaluateChangeRequest(simulation:ISimulation, changeData:*):Boolean
Evaluates a proposed change to the simulation state. | IRulesEngine | ||
initialize(simulation:ISimulation, rules:String):void
Begins initialization of the rules. | IRulesEngine | ||
onSimulationDataChanged(simulation:ISimulation, changeData:*):void
Invoked when the simulation data is changed. | IRulesEngine |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatch when rules engine initialization has completed. | IRulesEngine | |||
Dispatch when an interaction should be remediated. | IRulesEngine | |||
Dispatch when an error occurs. | IRulesEngine | |||
Dispatch when the simulation is in the required state. | IRulesEngine |
simulationStateReady | property |
simulationStateReady:Boolean
[read-only] Indicates whether the simulation is in the state specified by the rules.
public function get simulationStateReady():Boolean
cancel | () | method |
public function cancel():void
Cancels any rules engine processing currently in progress.
evaluateChangeRequest | () | method |
public function evaluateChangeRequest(simulation:ISimulation, changeData:*):Boolean
Evaluates a proposed change to the simulation state.
Note that, if the change is approved, the SimulationPlayer will invoke the simulation object's setData
method
with the changeData
parameter passed to the rules engine. This means that implementers can modify the change data
before it is passed to the simulation. If the change is not approved, implementers may wish to dispatch the
RulesEngineRemediationRequestEvent.REQUEST_REMEDIATION
event so that appropriate feedback may be displayed to the
user.
Parameters
simulation:ISimulation — The simulation to evaluate the proposed change against.
| |
changeData:* — The proposed change(s).
|
Boolean — true if the change is approved, false else.
|
initialize | () | method |
public function initialize(simulation:ISimulation, rules:String):void
Begins initialization of the rules. Implementers must dispatch the SimulationObjectEvent.INITIALIZATION_COMPLETE
event when rules engine initialization has completed.
Parameters
simulation:ISimulation — The simulation to evaluate the rules against.
| |
rules:String — The rules to use for evaluation.
|
onSimulationDataChanged | () | method |
public function onSimulationDataChanged(simulation:ISimulation, changeData:*):void
Invoked when the simulation data is changed.
Implementers must dispatch the SimulationObjectEvent.STATE_READY
event when
the simulation state matches the state defined by the rules.
Parameters
simulation:ISimulation — Required. An object that implements ISimulation interface.
| |
changeData:* — Required. An object containing the data that was changed.
|
initializationComplete | Event |
impression.events.SimulationObjectEvent
impression.events.SimulationObjectEvent.INITIALIZATION_COMPLETE
Dispatch when rules engine initialization has completed.
The SimulationObjectEvent.INITIALIZATION_COMPLETE constant defines the value of the type property of a simulation object initialization complete event object. This event has the following properties: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. |
rulesEngineRequestRemediation | Event |
impression.events.RulesEngineRemediationRequestEvent
impression.events.RulesEngineRemediationRequestEvent.REQUEST_REMEDIATION
Dispatch when an interaction should be remediated.
The RulesEngineRemediationRequestEvent.REQUEST_REMEDIATION constant defines the value of the type property of a remediation request event object. This event has the following properties: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. |
message | The remediation message to display. |
remediationData | Additional remediation data. |
simulationObjectError | Event |
impression.events.SimulationObjectErrorEvent
impression.events.SimulationPlayerErrorEvent.ERROR
Dispatch when an error occurs.
The SimulationPlayerErrorEvent.ERROR constant defines the value of the type property of an error event object. This event has the following properties: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. |
simulationStateReady | Event |
impression.events.SimulationObjectEvent
impression.events.SimulationObjectEvent.STATE_READY
Dispatch when the simulation is in the required state.
The SimulationObjectEvent.STATE_READY constant defines the value of the type property of a simulation object state ready event object. This event has the following properties: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. |