StyleSheetLoad

Kind of class:class
Inherits from:RetryableLoad < Load < EventDispatcher < CoreObject
Version:01/26/07
Author:Aaron Clinger
Classpath:org.casaframework.load.data.stylesheet.StyleSheetLoad
File last modified:Wednesday, 07 March 2007, 14:18:30
StyleSheet object to ease the chore of loading and assigning StyleSheets.

Unfortunately due the sub-par support of StyleSheets, this class cannot follow org.casaframework.load.base.BytesLoadInterface/org.casaframework.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.

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:TextField) : Void
Assigns StyleSheet to passed TextField. Can only be called after StyleSheet has successfully loaded.
Parameters:
target_txt:
Target TextField.
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.