MACROMEDIA FLASH MX 2004-USING COMPONENTS Use Manual page 70

Using components
Hide thumbs Also See for FLASH MX 2004-USING COMPONENTS:
Table of Contents

Advertisement

Custom style settings have priority over class, inherited, and global style settings.
For a list of the styles that each component supports, see the component entries in
"Components Dictionary," on page
To create a custom style declaration for a group of components:
Make sure the document contains at least one component instance.
1.
For more information, see
This example uses three button components with the instance names
different components, give them instance names in the Property inspector and use those
instance names in step 9.
Create a new layer in the Timeline and give it a name.
2.
Select a frame in the new layer on which (or before which) the component appears.
3.
Open the Actions panel.
4.
Use the following syntax to create an instance of the CSSStyleDeclaration object to define the
5.
new custom style format:
var styleObj = new mx.styles.CSSStyleDeclaration();
Set the
6.
styleName
styleObj.styleName = "newStyle";
Place the style on the
7.
_global.styles.newStyle = styleObj;
You can also create a CSSStyleDeclaration object and assign it to a new style declaration by
using the following syntax:
var styleObj = _global.styles.newStyle = new
mx.styles.CSSStyleDeclaration();
Use the following syntax to specify the properties you want to define for the
8.
style declaration:
styleObj.setStyle("fontFamily", "_sans");
styleObj.setStyle("fontSize", 14);
styleObj.setStyle("fontWeight", "bold");
styleObj.setStyle("textDecoration", "underline");
styleObj.setStyle("color", 0x336699);
styleObj.setStyle("themeColor", "haloBlue");
In the same Script pane, use the following syntax to set the
9.
components to the custom style declaration:
a.setStyle("styleName", "newStyle");
b.setStyle("styleName", "newStyle");
c.setStyle("styleName", "newStyle");
Now you can access styles on the custom style declaration using the
methods through its global
style on the
newStyle
_global.styles.newStyle.setStyle("themeColor", "haloOrange");
70
Chapter 5: Customizing Components
91.
"Adding components to Flash documents" on page
property of the style declaration to name the style:
list:
_global.styles
property. The following code sets the
styleName
style declaration:
44.
,
, and
a
b
newStyle
property of three specific
styleName
and
setStyle()
backgroundColor
Chapter 6,
. If you use
c
getStyle()

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents