EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Getstyle (Stylesheet.getstyle Method)

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
1146 ActionScript classes
}
trace("");
};
getStyle (StyleSheet.getStyle method)
public getStyle(name:String) : Object
Returns a copy of the style object associated with the specified style (name). If there is no style
object associated with
name, the method returns null.
Availability: ActionScript 1.0; Flash Player 7
Parameters
name:String - The name of the style to retrieve.
Returns
Object - A style object; otherwise null.
Example
The following example loads styles from a CSS file, parses the StyleSheet and displays style
names and property values in the Output panel. Create a ActionScript file called
StyleSheetTracer.as and enter the following code in the file:
import TextField.StyleSheet;
class StyleSheetTracer {
// StyleSheetTracer.displayFromURL
// This method displays the CSS style sheet at
// the specified URL in the Output panel.
static function displayFromURL(url:String):Void {
// Create a new StyleSheet object
var my_styleSheet:StyleSheet = new StyleSheet();
// The load operation is asynchronous, so set up
// a callback function to display the loaded StyleSheet.
my_styleSheet.onLoad = function(success:Boolean) {
if (success) {
StyleSheetTracer.display(this);
} else {
trace("Error loading style sheet "+url);
}
};
// Start the loading operation.
my_styleSheet.load(url);
}
static function display(my_styleSheet:StyleSheet):Void {
var styleNames:Array = my_styleSheet.getStyleNames();
if (!styleNames.length) {

Table of Contents

Related product manuals