EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - Page 705

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT
816 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
TextField.StyleSheet.getStyleNames() 705
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
See also
TextField.StyleSheet.setStyle()
TextField.StyleSheet.getStyleNames()
Availability
Flash Player 7.
Usage
styleSheet.getStyleNames()
Parameters
None.
Returns
An array.
Description
Method; returns an array that contains the names (as strings) of all of the styles registered in this
style sheet.
Example
This example creates a style sheet object named styleSheet that contains two styles, heading
and
bodyText. It then invokes the style sheet objects getStyleNames() method, assigns the
results to the array
names_array, and displays the contents of the array in the Output panel.
var styleSheet= new TextField.StyleSheet();
styleSheet.setStyle("heading", {
fontsize: '24px’
});
styleSheet.setStyle("bodyText", {
fontsize: '12px'
});
var names_array = styleSheet.getStyleNames();
trace(names.join("\n"));

Table of Contents

Related product manuals