![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
Flash Player 7.
styleSheet
.getStyle(styleName
)
styleName
A string that specifies the name of the style to retrieve.
An object.
Method; returns a copy of the style object associated with the style named styleName
. If there is no style object associated with styleName
, null
is returned.
Suppose a style sheet object named textStyles
loads an external style sheet file named styles.css that contains a single style named heading
, which defines font-family
, font-size
, and font-weight
properties, as shown below.
// In styles.css heading { font-family: Arial; font-size: 24px; font-weight: bold; }
The following code loads the styles from the CSS file, and then displays each property name and its value in the Output panel.
var styleSheet = new TextField.styleSheet(); styleSheet.load("styles.css"); var sectionStyle = styleSheet.getStyle("heading"); for(property in sectionStyle) { var propName = property; var propValue = sectionStyle[property]; trace(propName + " : " + propValue); }
This would display the following in the Output panel:
fontfamily : Arial fontsize : 24px fontweight : bold
TextField.StyleSheet.setStyle()
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |