my_styleSheet.setStyle("emphasized", styleObj);
delete styleObj;
var styleNames_array:Array = my_styleSheet.getStyleNames();
for (var i=0;i<styleNames_array.length;i++) {
var styleName:String = styleNames_array[i];
var thisStyle:Object = my_styleSheet.getStyle(styleName);
trace(styleName);
for (var prop in thisStyle) {
trace("\t"+prop+": "+thisStyle[prop]);
}
trace("");
}
This writes the following information to the log file:
emphasized
fontWeight: bold
color: #000000
Note: The line of code
not necessary, this step reduces memory usage, because Flash Player creates a copy of the style
object you pass to
See also
{} (object initializer)
TextField.StyleSheet.transform()
Availability
Flash Player 7.
Usage
styleSheet.transform(style:Object) : TextFormat
Parameters
An object that describes the style, containing style rules as properties of the object, or
style
.
null
Returns
A TextFormat object containing the result of the mapping of CSS rules to text format properties.
Description
Method; extends the CSS parsing capability.
Advanced developers can override this method by extending the TextField.StyleSheet class. For
more information, see
774
Chapter 7: ActionScript for Flash
deletes the original style object passed to
delete styleObj
.
setStyle()
"Creating subclasses" on page
55.
. While
setStyle()
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?