|
||||||
|
||||||
Skinning Components with Style

Free
Members Tutorial
![]()
Changing Style Properties for Components
Skinning or Styling refers to the user's option to change some of the appearance aspects of the Components in the Flash Movie using ActionScript. With the example in this tutorial you will be able to take almost any graphical Flash 8 or MX04 Component and quickly transform its many properties to fit any theme on any website.
Below is an example file setup to let you view real-time how the Button, CheckBox, ComboBox, List, RadioButton, and TextArea Components behave when their style Halo Theme properties are changed:
Example: Download the Flash file Com 608a
There are many levels upon which you can set a Style property, including the Class, Theme, and Component type levels. The lowest level would be styling an individual Component, and the highest would be styling all Components of all types in a Flash Movie. These are the two levels that will be discussed in this tutorial: Individual and Global Skinning.
Example: Download the Flash file Com 608b
Halo orange theme with a single Component.
Note: For a complete listing of all the properties associated with each Component, refer to this pdf file: Component Style Properties.pdf
Styling Individual Components
If you have only one Component in your Flash Movie and you would like to change its Style properties, or if you have many but only want to change one specific Component's properties, then it's most practical to use code to skin your Components individually.
Note: Styling for both the Halo and Sample Theme Components is the same except both have certain differences in what properties they will accept. For example, the property themeColor is exclusive to the Halo theme, and symbolColor is exclusive to the Sample theme. Look in the Help file to verify that the property you are about to change is supported by that Theme (how to do this is discussed below).
Cross Ref: Sample Theme
Step One: Setting up the Flash Document
Step Two: Setting up the Button Component
For Flash MX04: Window > Development Panels > Components (Ctrl F7)
Note: A Button Component is now on the Stage. It maybe under the Components Panel!
For Flash MX04: Window > Properties (Ctrl F3)

New Layer called: Actions.
Step Three: Changing Style Properties
For Flash MX04: Window > Development Panels > Actions (F9)
_root.sampleButton.setStyle("themeColor", "haloOrange");
Cross Ref: In you do not know how to input code into the Actions Panel see the tutorial on the Actions Panel
You will have to Hover Over or Click the sampleButton to see the Orange Theme.
The following line contains two parameters that change the Component style:
_root.sampleButton.setStyle("themeColor", "haloOrange");
The first parameter "themeColor" refers to the property you are about to change. In this case, you are about to change the overall "halo" theme. This parameter is always a string.
The next parameter "haloOrange" is the value you are going to change the property to. For the halo theme, the default value is "haloGreen", thus the green color you see most Components in. This line of code changes that value to "haloOrange", a preset value in Flash that gives your Components an orange color. This parameter may or may not be a String.
Note: A String is a line of text with "Quote Marks around it". As a rule of thumb, the following are usually not strings:
All other style property values must be set inside quotations.
Each property also has a set type of possible values that it will accept. For example:
Those are some of the most common properties and their possible values. To view possible values for other Component properties, along with other important information:
Browse to the Component type you want to change. In this case Button Component.
Example: Using Styles with Button Components
Global
Styling All Components
If you have more than one Component and you would like to change a specific style property for all of them at once, then it is more efficient to set a global style change so that all the Components in your Flash Movie will look the same.
Example: Download the Flash file Com 608c
Halo Orange theme with multiple Components
Step Four: Setting up the Flash Document
For Flash MX04: Window > Development Panels > Components (Ctrl F7)
A Button Component is now on the Stage.Note: It maybe under the Component Panel!
A CheckBox Component is now on the Stage.
A ComboBox Component is now on the Stage.
A RadioButton Component is now on the Stage.
New Layer called: Actions.
Step Five: Changing Style Properties
For Flash MX04: Window > Development Panels > Actions (F9)
_global.style.setStyle("themeColor", "haloOrange")
Example: Download the Flash file Com 608c
All four Components now have an orange theme
The ActionScript Explained:
For an explanation on the two parameters refer back to Styling Individual Halo Theme Components: Step Three
_global.style.setStyle("themeColor", "haloOrange")
This time we have replaced the reference to the Component's instance name with "_global.style". This in effect makes a global statement that any Components inside the Movie will have its themeColor property changed to haloOrange. This can be overridden if another style property comes afterwards. To see this in action:
Step Six: Overriding the Global Style
_root.sampleButton.setStyle("themeColor", "haloBlue");
Example: Download the Flash file Com 608d
Click the button to see the Blue Halo and the rest still have an Orange Halo.
Now all your Components have the orange theme except the button Component, which now has the Blue theme.
Why not try out webwasp's new community. Meet new people, find friends in your area: Webwasp Mates & Dates
•
4619 visitors to this page since
Sept 06 •
|
|
|
All material on this site is protected under international copyright © law. DO NOT reproduce any material from this site without written permission. Please ask as permission is often granted.
|