Packageimpression.players
Classpublic class RTFPlayer
InheritanceRTFPlayer Inheritance RenderingPlayer Inheritance BasePlayer Inheritance flash.events.EventDispatcher

The RTFPlayer class manages the display of RichText storyboards. These storyboards contain formatted text and an optional background graphic. The text is formatted using a subset of the RichTextFormat (RTF) specification.

See also

impression.utilities.RTFConverter


Public Properties
 PropertyDefined By
 InheritedalwaysCheckComplete : Boolean
Specifies how the object should handle storyboard completion.
BasePlayer
 InheritednarrationComplete : Boolean
Indicates whether narration has finished playing.
BasePlayer
 InheritedrenderingSurface : Sprite
The object to render content on.
RenderingPlayer
 Inheritedresolver : AssetResolver
The AssetResolver to use to request external assets.
RenderingPlayer
 Inheritedstoryboard : Storyboard
[override] The storyboard associated with the player.
RenderingPlayer
Public Methods
 MethodDefined By
  
RTFPlayer(renderingSurface:Sprite = null, resolver:AssetResolver = null)
Creates a new instance of the RTFPlayer.
RTFPlayer
 Inherited
Causes the player to examine the completion criteria for the current storyboard.
BasePlayer
 Inherited
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.
RTFPlayer
 Inherited
getStyle(style:String):Object
Retrieves a style property.
RenderingPlayer
  
[static] Retrieves the default style map for the RTFPlayer.
RTFPlayer
 Inherited
redraw():void
Forces a complete redraw of the content.
RenderingPlayer
  
[static] Removes all properties set by the player.
RTFPlayer
  
setStoryboardState(sb:Storyboard, state:String):void
[static] Modifies the storyboard to match the described state passed.
RTFPlayer
 Inherited
setStyle(style:String, value:Object):void
Sets a style property.
RenderingPlayer
Protected Methods
 MethodDefined By
 Inherited
Removes any connections between the rendering surface and the player.
RenderingPlayer
  
[override] Removes all content from the surface.
RTFPlayer
 Inherited
Initializes the storyboard.
BasePlayer
 Inherited
[override] Loads the storyboard.
RenderingPlayer
 Inherited
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
 Inherited
Draws the background rectangle onto the rendering surface.
RenderingPlayer
  
[override] Renders the content onto the surface.
RTFPlayer
 Inherited
[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
 InheritedDispatched when the player begins to load external assets.RenderingPlayer
 InheritedDispatched when all external assets have finished loading.RenderingPlayer
 InheritedDispatched when some type of input or output failure occurs.RenderingPlayer
 InheritedDispatched after a storyboard is initialized.BasePlayer
 InheritedDispatched 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
 InheritedDispatched when some type of input or output failure occurs.RenderingPlayer
 InheritedDispatched before a storyboard is unloaded.BasePlayer
 InheritedDispatched when some type of input or output failure occurs.RenderingPlayer
Styles
 Style Description Defined By
  
antiAliasType
Type: String
The type of anti-aliasing used for this text field.

Use flash.text.AntiAliasType constants for this property. You can control this setting only if the font is embedded (with the embedFonts style property set to true).

The default value is AntiAliasType.ADVANCED.
RTFPlayer
 InheritedType: Boolean
Whether or not the primary asset should be resized when loaded to width x height.
RenderingPlayer
 InheritedType: Number
The background color transparency of the rendering surface.
RenderingPlayer
 InheritedType: uint Format: Color
The background color of the rendering surface.
RenderingPlayer
  
bulletChar
Type: String
Specifies the character to use for the bullet for unordered lists. The default value is "●" (character code 0x25CF).
RTFPlayer
  
bulletFont
Type: String
The font family name used for the bullet character in unordered lists. The default value is "Arial".
RTFPlayer
  
bulletScale
Type: Number
Indicates the scale factor to use for the font size for the bullet character in unordered lists. The default value is 1.
RTFPlayer
 InheritedType: Boolean
The value of all assets' cacheAsBitmap property that the player should set once the asset is loaded.
RenderingPlayer
  
cacheConvertedRTF
Type: Boolean
Specifies when the RTFText property should be converted to Flash-conformant HTML.

If this style value is true, the RTFText string will be converted to Flash-conformant HTML every time the storyboard is rendered. If this style value is false, the RTFText string will be converted only if the htmlText storyboard persisted property is the empty string ("").

The default value is false.
RTFPlayer
 InheritedType: Object
The default LoaderContext object to use when assets are loaded.
RenderingPlayer
  
defaultBackgroundImageAlpha
Type: Number
Specifies the default opacity of the background image.

This style value is only used if the BackgroundAlpha persisted property does not exist. A style value of 0 indicates fully transparent, while a style value of 1 indicates fully opaque.

The default value is 0.5.
RTFPlayer
  
defaultTextFormat
Type: flash.text.TextFormat
The TextFormat object to use during conversion. The default value is null.
RTFPlayer
  
embedFonts
Type: Boolean
Indicates whether embedded fonts should be used. The default value is false.
RTFPlayer
  
forceDefaultFont
Type: Boolean
Indicates whether font changes in the source RTF should be removed and replaced with the default font name. The default value is false.
RTFPlayer
 InheritedType: Number Format: Length
The height of the rendering surface, in pixels.
RenderingPlayer
 InheritedType: Boolean
Whether or not the rendering surface should be masked to width x height.
RenderingPlayer
  
tabStopInterval
Type: Number
Indicates the interval, in pixels, of tab stops used during conversion. Tab stops will be generated for every tabStopInterval interval from 0 to tabStopMax. The default value is 20.
RTFPlayer
  
tabStopMax
Type: Boolean
Indicates the maximum value, of the tab stops used during conversion. The default value is 3000.
RTFPlayer
  
textFieldMarginX
Type: Number
Specifies the horizontal spacing between the internal TextField and the rendering surface. The default value is 20.
RTFPlayer
  
textFieldMarginY
Type: Number
Specifies the vertical spacing between the internal TextField and the rendering surface. The default value is 20.
RTFPlayer
 InheritedType: Number Format: Length
The width of the rendering surface, in pixels.
RenderingPlayer
Constructor Detail
RTFPlayer()Constructor
public function RTFPlayer(renderingSurface:Sprite = null, resolver:AssetResolver = null)

Creates a new instance of the RTFPlayer.

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
eraseSurface()method
override 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. When erasing a rendering surface, the RTFPlayer performs the following actions:

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.

Returns
String — The state of the storyboard.
getStyleDefinition()method 
public static function getStyleDefinition():Object

Retrieves the default style map for the RTFPlayer.

Returns
Object — Default styles object.
renderContent()method 
override protected function renderContent():void

Renders the content onto the surface.

To render content, the RTFPlayer performs the following actions:

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
  • htmlText (if the RTFText property value is not the empty string ("")
  • 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

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.