Flash CS3 Documentation |
|||
| Learning ActionScript 2.0 in Adobe Flash > Working with Text and Strings > Formatting text with Cascading Style Sheet styles > Creating new styles with ActionScript | |||
You can create new text styles with ActionScript by using the setStyle() method of the TextField.StyleSheet class. This method takes two parameters: the name of the style and an object that defines that style's properties.
For example, the following code creates a style sheet object named styles that defines two styles that are identical to the ones you already imported (see Loading external CSS files):
var styles:TextField.StyleSheet = new TextField.StyleSheet();
styles.setStyle("bodyText",
{fontFamily: 'Arial,Helvetica,sans-serif',
fontSize: '12px'}
);
styles.setStyle("headline",
{fontFamily: 'Arial,Helvetica,sans-serif',
fontSize: '24px'}
);
Flash CS3
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00000911.html
Comments
turbidity said on Mar 5, 2008 at 10:47 AM :