}
trace("");
};
getStyle (StyleSheet.getStyle method)
public getStyle(name:String) : Object
Returns a copy of the style object associated with the specified style (
object associated with
Availability: ActionScript 1.0; Flash Player 7
Parameters
- The name of the style to retrieve.
name:String
Returns
- A style object; otherwise
Object
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) {
1146
ActionScript classes
, the method returns
name
.
null
name
.
null
). If there is no style
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?