16
Chapter 1: Working with Flash MX 2004
You must create the class file before turning the symbol into a component. If Flash does not
convert your symbol into a component, it most likely cannot find the ActionScript class. Another
possibility is that the class file is not in the Flash classpath.
To convert a symbol into a component:
1.
Create an ActionScript class file and save it with an .as filename extension.
For more information on creating ActionScript class files, see the examples in
Chapter 2,
“Creating Basic Components in Flash MX 2004,” on page 23
.
2.
Save the FLA file that you are working in. If you do not save the document, Flash does not try
to establish a link between the FLA file and the class file.
3.
Right-click the custom component’s symbol name in the Library.
4.
Select Component Definition.
The Component Definition panel appears.
5.
Enter the class name in the AS 2.0 Class text box. You must enter the fully qualified class name,
if the class is in a package. Do not include the filename extension. For example, if the classname
is MyComponent.as, enter
MyComponent
.
6.
Click OK.
Flash transforms the symbol into a component and populates the Parameters box with the
component properties that are available in the class file and the classes from which your class
inherits, as the following figure shows:
Exporting components
Flash MX 2004 exports components as component packages (SWC files). A SWC file contains all
the code, SWF files, images, and metadata associated with the component, so you can easily add
it to your Flex environment. When you distribute a component, you only need to give your users
the SWC file.
SWC files are usually copied into a single directory for use in Flex or Flash, so each component
must have a unique filename to prevent conflicts.
This section describes a SWC file and explains how to import and export SWC files in Flash.
Содержание 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 ...