StyleSheetLoad

Kind of class:class
Inherits from:RetryableLoad < Load < EventDispatcher < CoreObject
Version:04/13/07
Author:Aaron Clinger
Classpath:org.casalib.load.data.stylesheet.StyleSheetLoad
File last modified:Monday, 01 December 2008, 13:34:40
StyleSheet object to ease the chore of loading and assigning StyleSheets.

Unfortunately due the sub-par support of StyleSheets, this class cannot follow org.casalib.load.base.BytesLoadInterface/org.casalib.load.base.BytesLoad. The StyleSheet class does not include getBytesLoaded or getBytesTotal for reasions that are totally unclear.
Since:
  • Flash Player 7
Example:
  • this.createTextField("headline_txt", this.getNextHighestDepth(), 50, 50, 300, 100);
    this.headline_txt.border = this.headline_txt.background = this.headline_txt.html = true;
    
    function initTextField(sender:StyleSheetLoad):Void {
        sender.assignStyleSheet(this.headline_txt);
        this.headline_txt.htmlText = "<h1>Heading</h1>";
    }
    
    var loadStyle:StyleSheetLoad = new StyleSheetLoad("style.css");
    this.loadStyle.addEventObserver(this, StyleSheetLoad.EVENT_LOAD_COMPLETE, "initTextField");
    this.loadStyle.start();
Usage note:
  • Class will stall and fail silently if a empty CSS file is loaded, do to an error in the StyleSheet object.

Summary


Constructor
  • StyleSheetLoad (styleSheetPath:String)
    • Defines file and location of load triggered by start.
Class properties

Constructor

StyleSheetLoad

function StyleSheetLoad (
styleSheetPath:String)

Defines file and location of load triggered by start.
Parameters:
styleSheetPath:
The absolute or relative URL of the CSS file to be loaded.

Instance methods

assignStyleSheet

function assignStyleSheet (
target_txt:Object) : Void

Assigns StyleSheet to passed TextField. Can only be called after StyleSheet has successfully loaded.
Parameters:
target_txt:
Usage note:
  • StyleSheets in Flash are extremely buggy. It is best to call assignStyleSheet before assigning text to a TextField.

destroy

function destroy (
) : Void

getStyleSheet

function getStyleSheet (
) : StyleSheet

Returns:
  • Returns the StyleSheet object StyleSheetLoad class is wrapping and loading.