MACROMEDIA FLEX - DEVELOPING COMPONENTS AND THEMES Manual page 25

Developing flex components and themes in flash authoring
Table of Contents

Advertisement

super.init();
invalidate(); // Required call so that Flex draws the component.
}
}
Return to the Flash environment. Right-click the square and select Convert to Symbol.
8.
The Convert To Symbol dialog box appears.
In the Convert to Symbol dialog box, set the Name, Identifier, and AS 2.0 Class fields to
9.
greensquare. To access the Identifier and AS 2.0 Class fields, you must select the Export for
ActionScript check box.
Click OK.
10.
Flash adds the greensquare symbol to the Library as a Movie Clip.
Convert the symbol to a component by right-clicking the symbol in the Flash Library and
11.
selecting Component Definition.
In the Component Definition dialog box, set the AS 2.0 Class field to greensquare.
12.
Right-click the symbol in the Flash Library and select Export SWC File.
13.
The Export File dialog box appears.
Save the new SWC file as greensquare.swc.
14.
In a text editor, create a new MXML file that contains the following code:
15.
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*">
<greensquare/>
</mx:Application>
Save the MXML file as greentest.mxml. You cannot name the file greensquare.mxml. You must
16.
give it a name that is different from the component's name, such as greentest.mxml.
Copy the SWC component you created (greensquare.swc) to the same directory as the MXML
17.
file. This should not be the same directory into which you saved the ActionScript and FLA files.
This directory must be in the web application's directory structure so that Flex can compile a
SWF from the MXML file.
Request the MXML file in your browser or a stand-alone Flash Player. A green square should
18.
appear.
Creating the Orange Circle
This section describes how to create the Orange Circle component. This component is different
from the Green Square because its ActionScript class file exists in a package. As a result, there are
additional steps that you must take to build it in Flash, and then refer to it in your MXML file.
The Orange Circle component prints a shape on the screen. The shape is orange and circular.
Creating simple components
25

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?

Questions and answers

This manual is also suitable for:

Flex

Table of Contents