User Guide
774 Chapter 7: ActionScript for Flash
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
delete styleObj deletes the original style object passed to setStyle(). While
not necessary, this step reduces memory usage, because Flash Player creates a copy of the style
object you pass to
setStyle().
See also
{} (object initializer)
TextField.StyleSheet.transform()
Availability
Flash Player 7.
Usage
styleSheet.transform(style:Object) : TextFormat
Parameters
style
An object that describes the style, containing style rules as properties of the object, or
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 “Creating subclasses” on page 55.