Packagecom.ghostwire.ui.managers
Classpublic class uiTextStyles
InheritanceuiTextStyles Inheritance flash.text.StyleSheet

The uiTextStyles manager is the central depository of text formatting information. This class is used by uiText components in the Aspire UI Framework.

uiTextStyles cannot be instantiated via the new operator. To access the singleton instance, use uiTextStyles.manager.

~ This class is available in Aspire UI Components Lite Edition ~

See also

com.ghostwire.ui.controls.uiText
flash.text.StyleSheet


Public Properties
 PropertyDefined by
  manager : uiTextStyles
[static][read-only] Indicates the shared instance of the uiTextStyles singleton class.
uiTextStyles
Public Methods
 MethodDefined by
  
clear():void
Removes all styles.
uiTextStyles
  
getStyleInfo(styleName:String = "default"):Object
Returns an object with information pertaining to the style to use.
uiTextStyles
  
getTextSize(text:String, html:Boolean = false, wrap:uint = 0, styleName:String = "default", embedFonts:Boolean = false):Object
Returns an object containing the properties width and height, describing the dimensions of a string of text formatted using the style styleName.
uiTextStyles
  
load(cssURL:String):void
Loads an external css file.
uiTextStyles
  
parseCSS(CSSText:String):void
Parses the CSS in CSSText and populates this manager with the styles.
uiTextStyles
  
setStyle(styleName:String, styleObject:Object):void
Adds a new style with the specified styleName to this manager.
uiTextStyles
Events
 EventSummaryDefined by
   Dispatched when CSS file has been loaded successfully and the manager is populated with the styles.uiTextStyles
   Dispatched when loading of CSS file has failed.uiTextStyles
   Dispatched when one or more styles have been changed.uiTextStyles
Property detail
managerproperty
manager:uiTextStyles  [read-only]

Indicates the shared instance of the uiTextStyles singleton class.

Implementation
    public static function get manager():uiTextStyles
Method detail
clear()method
public override function clear():void

Removes all styles. Note that Aspire uses a default fontFamily of "Tahoma" and fontSize of 12.

getStyleInfo()method 
public function getStyleInfo(styleName:String = "default"):Object

Returns an object with information pertaining to the style to use. The object contains the properties textFormat, outline and shadow. Note that uiTextStyleSheet only provides the formatting information; the actual formatting is done by the uiText class.

The textFormat property holds the TextFormat object to be used for formatting the text.

The outline property holds the hexadecimal color value to use when drawing the outline of the font glyphs. If this property is null, no outline should be drawn.

The shadow property holds the hexadecimal color value to use when drawing the drop shadow of the text. If this property is null, no drop shadow should be drawn.

Parameters
styleName:String (default = "default") — [Optional] String value indicating the name of the style to use. If undefined, the style name "default" is used.

Returns
Object — An Object with properties textFormat, outline and shadow.

See also

getTextSize()method 
public function getTextSize(text:String, html:Boolean = false, wrap:uint = 0, styleName:String = "default", embedFonts:Boolean = false):Object

Returns an object containing the properties width and height, describing the dimensions of a string of text formatted using the style styleName.

Parameters
text:String — String value indicating the text to measure.
 
html:Boolean (default = false) — [Optional] Boolean value indicating whether HTML tags in the text should be parsed.
 
wrap:uint (default = 0) — [Optional] Positive integer value indicating the width at which the text should wrap.
 
styleName:String (default = "default") — [Optional] String value indicating the name of the style to use.
 
embedFonts:Boolean (default = false)

Returns
Object — An Object with properties width and height.
load()method 
public function load(cssURL:String):void

Loads an external css file. After the loading has been completed, the data will be parsed and the manager will be populated with styles defined in the external css file.

When the external css file is loaded sucessfully, the parseCSS() method will be called, invoking a SyncEvent.SYNC event one frame interval later (notifying all uiText objects).

If you have your CSS defined within your application code, use parseCSS() instead.

Parameters
cssURL:String — A String value indicating the external CSS file to load and parse.

See also

parseCSS()method 
public override function parseCSS(CSSText:String):void

Parses the CSS in CSSText and populates this manager with the styles. If a style in CSSText already exists in the manager, the existing properties are retained, and only the ones in CSSText are added or changed.

Calling this method invokes a SyncEvent.SYNC event one frame interval later.

Parameters
CSSText:String — A String value indicating the CSS to parse.
setStyle()method 
public override function setStyle(styleName:String, styleObject:Object):void

Adds a new style with the specified styleName to this manager. If the named style does not already exist, it is added. If the named style already exists, it is replaced. If the styleObject parameter is null, the named style is removed.

Calling this method invokes a SyncEvent.SYNC event one frame interval later.

Parameters
styleName:String — A String value indicating the name of the style to add or modify.
 
styleObject:Object — An Object containing the properties to apply to the indicated style.
Event detail
completeevent 
Event object type: flash.events.Event

Dispatched when CSS file has been loaded successfully and the manager is populated with the styles.

ioErrorevent  
Event object type: flash.events.IOErrorEvent.IO_ERROR

Dispatched when loading of CSS file has failed.

syncevent  
Event object type: flash.events.SyncEvent

Dispatched when one or more styles have been changed. This event is dispatched one frame interval after parseCSS() or setStyle() method is called.