MACROMEDIA FLEX - DEVELOPING COMPONENTS AND THEMES Manual page 40

Developing flex components and themes in flash authoring
Table of Contents

Advertisement

In the component's class file, you must also override the name of the skin. Macromedia
recommends that you apply the skin to your component as a clip parameter in the
constructObject2()
especially true when the component creates child components that rely on the positioning of
the skin.
You can override some or all of the control's skins. For example, the Button control has the
following basic skins, each representing a state of the control:
falseUpSkin
falseDownSkin
falseOverSkin
falseDisabledSkin
trueUpSkin
trueDownSkin
trueOverSkin
trueDisabledSkin
Each state is represented as a variable in the class file, or is an inherited variable. By setting the
value of one of these variables, you instruct Flex to apply a new skin, using the symbol name to
find the skin.
When you add a new skin, it should respond to resizing and drawing methods of the component.
For a list of what skins are used by what controls, see each control's entry in Developing Flex
Applications.
This section describes a simple method for changing the skin for one of the states of the standard
Button control. You can use the steps in this procedure to change the skin for any visual control
in Flex.
To create a custom component with a different skin:
In the Flash environment, create a FLA file and set the classpath settings to include the Flex
1.
classes and the local directory. For more information, see
on page
10.
Insert a new symbol by selecting Insert > New Symbol. The Create New Symbol dialog box
2.
appears. This new symbol will be the new component.
In the Create New Symbol dialog box, do the following:
3.
Select the MovieClip for Behavior option (the default).
a
Select the Export for ActionScript check box.
b
Enter the appropriate name, identifier, and class file in the Name, Identifier, and AS 2.0
c
Class fields.
Clear the Export in First Frame check box.
d
In Edit Symbols mode for the new symbol, rename the Timeline's first layer to main, and add
4.
a
action in the Actions Frame.
stop()
40
Chapter 2: Creating Basic Components in Flash MX 2004
method rather than rely on the timing of the instantiation process. This is
"Changing the Flash classpath"

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX - DEVELOPING COMPONENTS AND THEMES and is the answer not in the manual?

This manual is also suitable for:

Flex

Table of Contents