Packageimpression.simulation
Interfacepublic interface ISimulationUI extends flash.events.IEventDispatcher

ISimulationUI defines the minimum functionality required for a simulation user interface.



Public Properties
 PropertyDefined By
  displayObject : DisplayObject
[read-only] Returns the display object representing the user interface.
ISimulationUI
  ownerGetsData : Boolean
[read-only] Determines how requests for simulation data are handled.
ISimulationUI
Public Methods
 MethodDefined By
  
onSimulationDataChanged(simulation:ISimulation, changeData:*):void
Invoked when simulation data has changed.
ISimulationUI
Events
 Event Summary Defined By
  Dispatch when the user interface wants to change the simulation state.ISimulationUI
  Dispatch when the user interface needs simulation data.ISimulationUI
  Dispatch when an error occurs.ISimulationUI
Property Detail
displayObjectproperty
displayObject:DisplayObject  [read-only]

Returns the display object representing the user interface.


Implementation
    public function get displayObject():DisplayObject
ownerGetsDataproperty 
ownerGetsData:Boolean  [read-only]

Determines how requests for simulation data are handled.

If this property value is true, it is the responsibility of the simulation owner to get data values when this object dispatches a SimulationDataChangeRequestEvent.DATA_CHANGE_REQUEST event. If this property value is false, the SimulationPlayer class will call the ISimulation object's getData() method to populate the data change request event object.

If your simulation and simulation user interface are contained within the same .SWF file, and can run as a standalone freeplay simulation, return true. If your simulation and simulation user interface are contained in separate files, or the simulation cannot run with the SimulationPlayer, return false. Note that the MagicBox sample simulation in the AS3 RTE DevKit returns a value of true for this property.


Implementation
    public function get ownerGetsData():Boolean
Method Detail
onSimulationDataChanged()method
public function onSimulationDataChanged(simulation:ISimulation, changeData:*):void

Invoked when simulation data has changed.

Note that this method may be invoked as a result of the implementer successfully dispatching the SimulationDataChangeRequestEvent.DATA_CHANGE_REQUEST event. The format of the changeData parameter is simulation-specific.

Parameters

simulation:ISimulation — The simulation object whose data has changed.
 
changeData:* — The data that has changed.

Event Detail
simulationDataChangeRequest Event
Event Object Type: impression.events.SimulationDataChangeRequestEvent
SimulationDataChangeRequestEvent.type property = impression.events.SimulationDataChangeRequestEvent.DATA_CHANGE_REQUEST

Dispatch when the user interface wants to change the simulation state.

Note that this event can be cancelled. If the event is cancelled, it is the responsibility of the ISimulationUI object to restore the visual state of the user interface to the state prior to the change request.

The SimulationDataChangeRequestEvent.DATA_CHANGE_REQUEST constant defines the value of the type property of a data change request event object. This event has the following properties:
PropertyValue
bubblesfalse
cancelabletrue; cancelling the event means that the simulation will not accept the change.
currentTargetThe object that is actively processing the Event object with an event listener.
targetThe object that raised the event.
changeDataThe proposed data to be changed.

See also

simulationDataRequest Event  
Event Object Type: impression.events.SimulationDataRequestEvent
SimulationDataRequestEvent.type property = impression.events.SimulationDataRequestEvent.DATA_REQUEST

Dispatch when the user interface needs simulation data.

The SimulationDataRequestEvent.DATA_REQUEST constant defines the value of the type property of a data request 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.
requestThe data change request.
dataThe simulation data.
simulationObjectError Event  
Event Object Type: impression.events.SimulationObjectErrorEvent
SimulationObjectErrorEvent.type property = 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:
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.
loadingIndicates whether or not the event occurred during the loading phase of the storyboard.
messageThe message associated with the error.
errorDataAdditional data associated with the error.
sourceThe type of object that initially raised the error.