User Guide
862 Chapter 2: ActionScript Language Reference
var styleObject:Object = my_styleSheet.getStyle(styleName);
for (var propName in styleObject) {
var propValue = styleObject[propName];
trace("\t"+propName+": "+propValue);
}
trace("");
}
}
}
}
Create a new CSS document called styles.css, which has two styles called heading and mainBody
that define properties for
font-family, font-size and font-weight. Enter the following code:
/* In styles.css */
.heading {
font-family: Arial, Helvetica, sans-serif;
font-size: 24px;
font-weight: bold;
}
.mainBody {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: normal;
}
And finally, in a FLA or AS file, enter the following ActionScript to load the external style sheet,
styles.css.
StyleSheetTracer.displayFromURL("styles.css");
This displays the following in the Output panel:Style .heading:
fontWeight: bold
fontSize: 24px
fontFamily: Arial, Helvetica, sans-serif
Style .mainBody:
fontWeight: normal
fontSize: 12px
fontFamily: Arial, Helvetica, sans-serif
See also
TextField.StyleSheet.setStyle()