![MACROMEDIA FLEX - DEVELOPING COMPONENTS AND THEMES Скачать руководство пользователя страница 25](http://html1.mh-extra.com/html/macromedia/flex-developing-components-and-themes/flex-developing-components-and-themes_manual_3388115025.webp)
Creating simple components
25
super.init();
invalidate(); // Required call so that Flex draws the component.
}
}
8.
Return to the Flash environment. Right-click the square and select Convert to Symbol.
The Convert To Symbol dialog box appears.
9.
In the Convert to Symbol dialog box, set the Name, Identifier, and AS 2.0 Class fields to
greensquare
. To access the Identifier and AS 2.0 Class fields, you must select the Export for
ActionScript check box.
10.
Click OK.
Flash adds the greensquare symbol to the Library as a Movie Clip.
11.
Convert the symbol to a component by right-clicking the symbol in the Flash Library and
selecting Component Definition.
12.
In the Component Definition dialog box, set the AS 2.0 Class field to
greensquare
.
13.
Right-click the symbol in the Flash Library and select Export SWC File.
The Export File dialog box appears.
14.
Save the new SWC file as greensquare.swc.
15.
In a text editor, create a new MXML file that contains the following code:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns="*">
<greensquare/>
</mx:Application>
16.
Save the MXML file as greentest.mxml. You cannot name the file greensquare.mxml. You must
give it a name that is different from the component’s name, such as greentest.mxml.
17.
Copy the SWC component you created (greensquare.swc) to the same directory as the MXML
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.
18.
Request the MXML file in your browser or a stand-alone Flash Player. A green square should
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.
Содержание FLEX - DEVELOPING COMPONENTS AND THEMES
Страница 1: ...Developing Flex Components and Themes in Flash Authoring ...
Страница 4: ...4 Contents ...
Страница 44: ...44 Chapter 2 Creating Basic Components in Flash MX 2004 ...
Страница 82: ...82 Index ...