Textfield.stylesheet.getstyle() - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

TextField.StyleSheet.getStyle()

Availability
Flash Player 7.
Usage
styleSheet.getStyle(styleName:String) : Object
Parameters
A string that specifies the name of the style to retrieve.
styleName
Returns
An object.
Description
Method; returns a copy of the style object associated with the style named
no style object associated with
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 new ActionScript file called StyleSheetTracer.as
and enter the following code:
import TextField.StyleSheet;
class StyleSheetTracer {
// StyleSheetTracer.displayFromURL
//
// This method displays the CSS style sheet at
// URL "url" to the Output Panel.
static function displayFromURL(url:String):Void {
// Create a new style sheet object
var my_styleSheet:StyleSheet = new StyleSheet();
// The load operation is asynchronous, so set up
// a callback function to display the loaded style sheet.
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) {
trace("This is an empty style sheet.");
} else {
for (var i = 0; i<styleNames.length; i++) {
var styleName:String = styleNames[i];
trace("Style "+styleName+":");
,
is returned.
styleName
null
styleName
TextField.StyleSheet.getStyle()
. If there is
861

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents