Package | impression.players |
Class | public class CanvasElement |
Inheritance | CanvasElement ![]() |
A CanvasElement may have an associated action. Note that the shell, not the CanvasElement, is responsible for triggering the action. Shell
authors may listen for events either directly from the CanvasElement or from the renderingSurface
of the Canvas itself to trigger
actions—all CanvasElement events have their bubbles
property value set to true
.
Property | Defined By | ||
---|---|---|---|
action : String [read-only]
Indicates the action type associated with the object. | CanvasElement | ||
active : Boolean
Indicates whether the object is active. | CanvasElement | ||
canvas : CanvasPlayer [read-only]
The CanvasPlayer associated with this object. | CanvasElement | ||
childElement : ChildElement [read-only]
The ChildElement associated with this object. | CanvasElement | ||
complete : Boolean
Indicates whether the object is complete. | CanvasElement | ||
hasLink : Boolean [read-only]
Indicates whether the element has a clickable link. | CanvasElement | ||
resolver : AssetResolver [read-only]
The AssetResolver associated with this object. | CanvasElement | ||
state : String [read-only]
Indicates the state of the object. | CanvasElement |
Method | Defined By | ||
---|---|---|---|
clearStyle(state:String, style:String):void
Deletes a style property. | CanvasElement | ||
getStyle(state:String, style:String):Object
Retrieves a style property. | CanvasElement | ||
getStyleDefinition():Object [static]
Retrieves the default style map for the element. | CanvasElement | ||
redraw():void
Redraws the element. | CanvasElement | ||
setStyle(state:String, style:String, value:Object):void
Sets a style property. | CanvasElement |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when the element encounters an error while loading a graphic. | CanvasElement | |||
Dispatched when the element's active property is changed to true. | CanvasElement | |||
Dispatched when the element is first created. | CanvasElement | |||
Dispatched when the element's complete property is changed to true. | CanvasElement | |||
Dispatched when the element completes loading of a graphic. | CanvasElement | |||
Dispatched when the element begins loading of a graphic. | CanvasElement | |||
Dispatched when the element is redrawn. | CanvasElement | |||
Dispatched when the element encounters an error while loading a graphic. | CanvasElement | |||
Dispatched when the element needs to determine the aggregate status of a location. | CanvasElement | |||
Dispatched when the element encounters an error while loading a graphic. | CanvasElement | |||
Dispatched when the element encounters an error while loading a graphic. | CanvasElement |
action | property |
action:String
[read-only]
Indicates the action type associated with the object. This property value will be one of the CanvasElementActionType
constants.
public function get action():String
See also
active | property |
active:Boolean
Indicates whether the object is active.
Changing this property value causes the childElement
property's active
persisted property
to be changed to the new value.
If this property value is changed from false
to true
, the childElement
property's
complete
persisted property is set to true
and the CanvasElementEvent.ELEMENT_ACTIVE
event is dispatched by the element. If the event is not cancelled, the element is redrawn. If this property value is changed
from true
to false
, no event is dispatched, and the element is redrawn.
Note that if this property changes the ChildElement's complete
persisted property to true
, the
CanvasElementEvent.ELEMENT_COMPLETE
event is not dispatched.
If the action
property value is CanvasElementActionTypes.JUMP
or CanvasElementActionTypes.DISPLAY_RANGE
, the
persisted property value is set, but no other action occurs.
public function get active():Boolean
public function set active(value:Boolean):void
See also
canvas | property |
canvas:CanvasPlayer
[read-only] The CanvasPlayer associated with this object.
public function get canvas():CanvasPlayer
childElement | property |
childElement:ChildElement
[read-only] The ChildElement associated with this object.
public function get childElement():ChildElement
complete | property |
complete:Boolean
Indicates whether the object is complete.
Changing this property value causes the childElement
property's complete
persisted property
to be changed to the new value and the element is redrawn. If the action
property value is
CanvasElementActionTypes.JUMP
or CanvasElementActionTypes.DISPLAY_RANGE
, changes to this property
value are ignored.
If this property value is changed from false
to true
, the CanvasElementEvent.ELEMENT_COMPLETE
is dispatched by the element.
public function get complete():Boolean
public function set complete(value:Boolean):void
See also
hasLink | property |
hasLink:Boolean
[read-only] Indicates whether the element has a clickable link.
public function get hasLink():Boolean
See also
resolver | property |
resolver:AssetResolver
[read-only] The AssetResolver associated with this object.
public function get resolver():AssetResolver
state | property |
state:String
[read-only]
Indicates the state of the object. This property value will be one of the CanvasElementState
constants.
If the value of the action
property is CanvasElementActionTypes.JUMP
or
CanvasElementActionTypes.DISPLAY_RANGE
, the property value will be based on the aggregate status of the
destination, as stored in the ChildElement
property's DestinationStatus
persistedn property.
For all other action types, the property value is based on the state of the active
and complete
properties. Note that if an element is active, the value of the is property is ACTIVE
. If the element is
not active, but is complete, the value of the is property is COMPLETE
. If the element is neither active nor
complete, the value of the is property is DEFAULT
.
public function get state():String
See also
clearStyle | () | method |
public function clearStyle(state:String, style:String):void
Deletes a style property.
Parameters
state:String — The state property value associated with the style.
| |
style:String — The name of the style property.
|
See also
getStyle | () | method |
public function getStyle(state:String, style:String):Object
Retrieves a style property.
If state
is one of the CanvasElementStates
constant values, the
style property referenced is the style property value to use when the state
property
matches the state
parameter. If state
is any other value, the style
property referenced is the style property value to use as a default value for all states.
Note that a default style property value set using this method will override an action- or state-specific style property value defined in the Canvas.
Parameters
state:String — The state property value associated with the style.
| |
style:String — The name of the style property.
|
Object — Style value.
|
See also
getStyleDefinition | () | method |
public static function getStyleDefinition():Object
Retrieves the default style map for the element.
Note that values from the default style map are used only if no value for a style was set using
the object's setStyle()
method or the CanvasPlayer's setElementStyle()
method.
Object — Default styles object.
|
See also
redraw | () | method |
public function redraw():void
Redraws the element.
When looking up a style to use for drawing, the CanvasElement determines the style value to use according to the following rules:
setStyle()
method for the current value of the state
property, it is used.setStyle()
method as a default value for all states, it is used.setElementStyle()
method for the current value of the action
property and the current value of the state
property, it is used.setElementStyle()
method for the current value of the state
property and all actions, it is used.setElementStyle()
method for all states and actions, it is used.Once the element is drawn, the CanvasElementEvent.ELEMENT_REDRAW
event is dispatched.
See also
setStyle | () | method |
public function setStyle(state:String, style:String, value:Object):void
Sets a style property.
If state
is one of the CanvasElementStates
constant values, the
style property referenced is the style property value to use when the state
property
matches the state
parameter. If state
is any other value, the style
property referenced is the style property value to use as a default value for all states.
Note that a default style property value set using this method will override an action- or state-specific style property value defined in the Canvas.
Parameters
state:String — The state property value associated with the style.
| |
style:String — The name of the style property.
| |
value:Object — The value of the style.
|
See also
diskError | Event |
flash.errors.IOErrorEvent
flash.errors.IOErrorEvent.DISK_ERROR
Dispatched when the element encounters an error while loading a graphic.
elementActive | Event |
impression.events.CanvasElementEvent
impression.events.CanvasElementEvent.ELEMENT_ACTIVE
Dispatched when the element's active
property is changed to true
.
Property | Value |
---|---|
bubbles | true |
cancelable | true ; canceling this event object suppresses redraw of the element. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The object that raised the event. |
canvasElement | The CanvasElement object assigned to the target. |
action | The value of the action property of canvasElement . |
See also
elementActive | Event |
impression.events.CanvasElementEvent
impression.events.CanvasElementEvent.ELEMENT_INITIALIZE
Dispatched when the element is first created.
The CanvasElementEvent.ELEMENT_INITIALIZE constant defines the value of the type property of a element initialized event object. This event has the following properties:Property | Value |
---|---|
bubbles | true |
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. |
canvasElement | The CanvasElement object assigned to the target. |
action | The value of the action property of canvasElement . |
See also
elementComplete | Event |
impression.events.CanvasElementEvent
impression.events.CanvasElementEvent.ELEMENT_COMPLETE
Dispatched when the element's complete
property is changed to true
.
Property | Value |
---|---|
bubbles | true |
cancelable | true ; canceling this event object suppresses redraw of the element. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The object that raised the event. |
canvasElement | The CanvasElement object assigned to the target. |
action | The value of the action property of canvasElement . |
See also
elementGraphicLoadComplete | Event |
impression.events.CanvasElementEvent
impression.events.CanvasElementEvent.ELEMENT_GRAPHIC_LOAD_COMPLETE
Dispatched when the element completes loading of a graphic.
The CanvasElementEvent.ELEMENT_GRAPHIC_LOAD_COMPLETE constant defines the value of the type property of a element graphic load complete event object. This event has the following properties:Property | Value |
---|---|
bubbles | true |
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. |
canvasElement | The CanvasElement object assigned to the target. |
action | The value of the action property of canvasElement . |
elementGraphicLoadInit | Event |
impression.events.CanvasElementEvent
impression.events.CanvasElementEvent.ELEMENT_GRAPHIC_LOAD_INIT
Dispatched when the element begins loading of a graphic.
The CanvasElementEvent.ELEMENT_GRAPHIC_LOAD_INIT constant defines the value of the type property of a element graphic load init event object. This event has the following properties:Property | Value |
---|---|
bubbles | true |
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. |
canvasElement | The CanvasElement object assigned to the target. |
action | The value of the action property of canvasElement . |
elementRedraw | Event |
impression.events.CanvasElementEvent
impression.events.CanvasElementEvent.ELEMENT_REDRAW
Dispatched when the element is redrawn.
The CanvasElementEvent.ELEMENT_REDRAW constant defines the value of the type property of a element redraw event object. This event has the following properties:Property | Value |
---|---|
bubbles | true |
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. |
canvasElement | The CanvasElement object assigned to the target. |
action | The value of the action property of canvasElement . |
See also
ioError | Event |
flash.errors.IOErrorEvent
flash.errors.IOErrorEvent.IO_ERROR
Dispatched when the element encounters an error while loading a graphic.
locationStatusRequest | Event |
impression.events.LocationStatusRequestEvent
impression.events.LocationStatusRequestEvent.LOCATION_STATUS_REQUEST
Dispatched when the element needs to determine the aggregate status of a location. This event is dispatched if the action
property value is CanvasElementActionTypes.JUMP
or CanvasElementActionTypes.DISPLAY_RANGE
, and is dispatched
when the element is redrawn.
If the aggregate status is LocationStatusTypes.COMPLETE
, the complete
property is set to true
and the CanvasElementEvent.ELEMENT_COMPLETE
event is dispatched.
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. |
location | The location to determine the status of. |
status |
networkError | Event |
flash.errors.IOErrorEvent
flash.errors.IOErrorEvent.NETWORK_ERROR
Dispatched when the element encounters an error while loading a graphic.
verifyError | Event |
flash.errors.IOErrorEvent
flash.errors.IOErrorEvent.VERIFY_ERROR
Dispatched when the element encounters an error while loading a graphic.