Packageimpression.players
Classpublic class RenderingPlayer
InheritanceRenderingPlayer Inheritance BasePlayer Inheritance flash.events.EventDispatcher
Subclasses CanvasPlayer, FlashObjectPlayer, RTFPlayer, SWFVideoPlayer

The RenderingPlayer class is the base class for all players that render content on a surface.

Unlike BasePlayer, RenderingPlayer is not typically used in a runtime.



Public Properties
 PropertyDefined By
 InheritedalwaysCheckComplete : Boolean
Specifies how the object should handle storyboard completion.
BasePlayer
 InheritednarrationComplete : Boolean
Indicates whether narration has finished playing.
BasePlayer
  renderingSurface : Sprite
The object to render content on.
RenderingPlayer
  resolver : AssetResolver
The AssetResolver to use to request external assets.
RenderingPlayer
  storyboard : Storyboard
[override] The storyboard associated with the player.
RenderingPlayer
Public Methods
 MethodDefined By
  
RenderingPlayer(renderingSurface:Sprite = null, resolver:AssetResolver = null)
Creates a new instance of the RenderingPlayer.
RenderingPlayer
 Inherited
Causes the player to examine the completion criteria for the current storyboard.
BasePlayer
  
clearStyle(style:String):void
Deletes a style property, reverting it back to its default value.
RenderingPlayer
  
[static] Creates a string describing the state of the storyboard.
RenderingPlayer
  
getStyle(style:String):Object
Retrieves a style property.
RenderingPlayer
  
[static] Retrieves the default style map for the current object.
RenderingPlayer
  
redraw():void
Forces a complete redraw of the content.
RenderingPlayer
  
[static] Removes all properties set by the player.
RenderingPlayer
  
setStoryboardState(sb:Storyboard, state:String):void
[static]
RenderingPlayer
  
setStyle(style:String, value:Object):void
Sets a style property.
RenderingPlayer
Protected Methods
 MethodDefined By
  
Removes any connections between the rendering surface and the player.
RenderingPlayer
  
Removes all content from the surface.
RenderingPlayer
 Inherited
Initializes the storyboard.
BasePlayer
  
[override] Loads the storyboard.
RenderingPlayer
  
Adds a mask to the rendering surface if the maskRenderingSurface style property value is true.
RenderingPlayer
 Inherited
Removes known completion criteria from the CompleteRemaining storyboard persisted property.
BasePlayer
  
Draws the background rectangle onto the rendering surface.
RenderingPlayer
  
Renders the content onto the rendering surface.
RenderingPlayer
  
[override] Performs cleanup actions when a storyboard is unloaded.
RenderingPlayer
Events
 Event Summary Defined By
 InheritedDispatched when the BasePlayer needs to resolve completion criteria beyond those defined for the class.BasePlayer
 InheritedDispatched when a storyboard is marked as complete.BasePlayer
  Dispatched when the player begins to load external assets.RenderingPlayer
  Dispatched when all external assets have finished loading.RenderingPlayer
  Dispatched when some type of input or output failure occurs.RenderingPlayer
 InheritedDispatched after a storyboard is initialized.BasePlayer
  Dispatched when some type of input or output failure occurs.RenderingPlayer
 InheritedDispatched when storyboard loading is complete.BasePlayer
 InheritedDispatched when a storyboard is loaded, but before any processing occurs.BasePlayer
  Dispatched when some type of input or output failure occurs.RenderingPlayer
 InheritedDispatched before a storyboard is unloaded.BasePlayer
  Dispatched when some type of input or output failure occurs.RenderingPlayer
Styles
 Style Description Defined By
  
autoSizeContent
Type: Boolean
Whether or not the primary asset should be resized when loaded to width x height. The default value is false.
RenderingPlayer
  
backgroundAlpha
Type: Number
The background color transparency of the rendering surface. The default value is 1.0.
RenderingPlayer
  
backgroundColor
Type: uint Format: Color
The background color of the rendering surface. The default value is 0x000000.
RenderingPlayer
  
cacheAsBitmap
Type: Boolean
The value of all assets' cacheAsBitmap property that the player should set once the asset is loaded The default value is false.
RenderingPlayer
  
context
Type: Object
The default LoaderContext object to use when assets are loaded. The default value is null.
RenderingPlayer
  
height
Type: Number Format: Length
The height of the rendering surface, in pixels. The default value is 480.
RenderingPlayer
  
maskRenderingSurface
Type: Boolean
Whether or not the rendering surface should be masked to width x height. The default value is true.
RenderingPlayer
  
width
Type: Number Format: Length
The width of the rendering surface, in pixels. The default value is 640.
RenderingPlayer
Property Detail
renderingSurfaceproperty
renderingSurface:Sprite

The object to render content on.

If the existing rendering surface has existing content, it is not removed prior to setting the new surface. Note that any loading in progress will be cancelled, and all communication with and references to the player are removed.

You must manually invoke the redraw() method if you want to render the current storyboard onto the new surface.


Implementation
    public function get renderingSurface():Sprite
    public function set renderingSurface(value:Sprite):void
resolverproperty 
resolver:AssetResolver

The AssetResolver to use to request external assets. When this value is set to a non-null value, the player registers itself with the resolver as an owner, and all content requested is requested using itself as the owner.

If the player is currently loading content, all load actions in progress will be cancelled when this property is set. When removing the references to an existing resolver, the player will unregister itself as an owner. If the new property value is not null, the player will register itself as an owner.


Implementation
    public function get resolver():AssetResolver
    public function set resolver(value:AssetResolver):void
storyboardproperty 
storyboard:Storyboard[override]

The storyboard associated with the player.

If null is passed, the current storyboard is unloaded, the 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 unload event is dispatched. If the event is not cancelled, the current storyboard is unloaded. If the event is cancelled, further processing stops.
  2. If the new storyboard is not null, the loadStart 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 initialize event is dispatched.
  4. External content load begins. If any external content is specified, the contentLoadBegin event is dispatched.
  5. If external content finishes loading, the contentLoadEnd event is dispatched, followed by the loadComplete event.
  6. If the loadComplete event was dispatched, the checkForComplete() method is invoked. If all completion criteria have been met, the complete event is dispatched.

If either the renderingSurface or resolver properties are null, the content will not be rendered, and no error will occur. Processing will continue as if all external assets have been loaded.


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

See also

Constructor Detail
RenderingPlayer()Constructor
public function RenderingPlayer(renderingSurface:Sprite = null, resolver:AssetResolver = null)

Creates a new instance of the RenderingPlayer.

Parameters
renderingSurface:Sprite (default = null) — The object to render content on.
 
resolver:AssetResolver (default = null) — The AssetResolver to use to request external assets.
Method Detail
clearStyle()method
public function clearStyle(style:String):void

Deletes a style property, reverting it back to its default value.

Parameters

style:String — The name of the style property.

See also

detachSurface()method 
protected function detachSurface():void

Removes any connections between the rendering surface and the player.

This method is invoked by the player when a storyboard is unloaded, the redraw() method is invoked, or the renderingSurface property is changed. In the RenderingPlayer, this method invokes the cancelOwnerTransaction() method of the resolver.

Descendant classes override this method to perform additional actions.

eraseSurface()method 
protected function eraseSurface():void

Removes all content from the surface.

This method is invoked by the player when a storyboard is unloaded or when the redraw() method is invoked. In the RenderingPlayer, this method performs the following actions:

Note that this method is not invoked by the player if the surface is being detached by setting the renderingSurface property.

Descendant classes override this method to perform additional actions.

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.
getStyle()method 
public function getStyle(style:String):Object

Retrieves a style property.

The type that this method returns varies depending on the style property that the method retrieves. The range of possible types includes Boolean; String; Number; int; a uint for an RGB color; a Class for a skin; or any kind of object.

If you call this method to retrieve a particular style property, it will be of a known type that you can store in a variable of the same type. Type casting is not necessary. Instead, a simple assignment statement like the following will work:

var backgroundColor:uint = getStyle("backgroundColor");

If the style property is not set in the style lookup chain, this method returns a value of undefined. Note that undefined is a special value that is not the same as false, "", NaN, 0, or null. No valid style value is ever undefined.

Unlike classes based on UIComponent, there is no inheritance chain for RenderingPlayer or its derived classes. All styles are set on a per-instance basis.

Parameters

style:String — The name of the style property.

Returns
Object — Style value.

See also

getStyleDefinition()method 
public static function getStyleDefinition():Object

Retrieves the default style map for the current object.

The style map contains the type that is appropriate for the object, and is dependant on the styles that the object uses.

Returns
Object — Default styles object.

See also

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:

See also

maskSurface()method 
protected function maskSurface():void

Adds a mask to the rendering surface if the maskRenderingSurface style property value is true.

The mask added to the surface is a Sprite. It is sized by drawing a rectangle on the Sprite's graphics object using a transparent line style with 0 width and a transparent fill. Note that any existing mask will be removed by this method, regardless of the maskRenderingSurface style property value.

Descendant classes override this method to perform additional actions.

redraw()method 
public function redraw():void

Forces a complete redraw of the content.

renderBackground()method 
protected function renderBackground():void

Draws the background rectangle onto the rendering surface.

The background rectangle is drawn using the backgroundColor, backgroundAlpha, width, and height style property values using a transparent line style with 0 width.

Note that the surface's graphics object's clear() method is invoked prior to drawing the background.

Descendant classes override this method to perform additional actions.

renderContent()method 
protected function renderContent():void

Renders the content onto the rendering surface.

As implemented by the RenderingPlayer class, this method performs no actions. Descendant classes override this method to render the content.

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.

See also

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

Parameters

sb:Storyboard
 
state:String

setStyle()method 
public function setStyle(style:String, value:Object):void

Sets a style property.

You must invoke the redraw() to see style changes.

Parameters

style:String — The name of the style property.
 
value:Object — The value of the style.

See also

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 RenderingPlayer performs the following actions:

See also

Event Detail
contentLoadBegin Event
Event Object Type: impression.events.StoryboardEvent
StoryboardEvent.type property = impression.events.StoryboardEvent.CONTENT_LOAD_BEGIN

Dispatched when the player begins to load external assets.

This event is dispatched when the redraw() method is invoked, either explicitly or implicitly as the result of setting the storyboard property to a non-null value.

This event will occur if any external assets are defined, even if they cannot be loaded. This event is dispatched when the resolverInfo object whose owner property value is the player dispatches its beginTransaction event.

The StoryboardEvent.CONTENT_LOAD_BEGIN constant defines the value of the type property of a content load begin 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.
contentLoadEnd Event  
Event Object Type: impression.events.StoryboardEvent
StoryboardEvent.type property = impression.events.StoryboardEvent.CONTENT_LOAD_END

Dispatched when all external assets have finished loading.

This event will occur if any external assets are defined, even if they cannot be loaded. This event is dispatched when the resolverInfo object whose owner property value is the player dispatches its endTransaction event.

The StoryboardEvent.CONTENT_LOAD_END constant defines the value of the type property of a content load end 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.
diskError Event  
Event Object Type: flash.events.IOErrorEvent
IOErrorEvent.type property = flash.events.IOErrorEvent.DISK_ERROR

Dispatched when some type of input or output failure occurs.

ioError Event  
Event Object Type: flash.events.IOErrorEvent
IOErrorEvent.type property = flash.events.IOErrorEvent.IO_ERROR

Dispatched when some type of input or output failure occurs.

networkError Event  
Event Object Type: flash.events.IOErrorEvent
IOErrorEvent.type property = flash.events.IOErrorEvent.NETWORK_ERROR

Dispatched when some type of input or output failure occurs.

verifyError Event  
Event Object Type: flash.events.IOErrorEvent
IOErrorEvent.type property = flash.events.IOErrorEvent.VERIFY_ERROR

Dispatched when some type of input or output failure occurs.