280
Classes
5.
Select File > New and then select Flash Document to create a new FLA file, and then
click OK.
6.
Select File > Save As, name the file
animal_test.fla
, and save the file to the same folder as
the Animal.as file you created in step 2.
7.
Select Insert > New Symbol to launch the Create New Symbol dialog box.
8.
Enter a symbol name of
animal
, and select the Movie Clip option.
9.
Click the Advanced button in the lower-right corner of the Create New Symbol dialog box
to enable more options.
The Advanced button is available when you are in the basic mode of the Create New
Symbol dialog box.
10.
Click the Export for ActionScript check box in the Linkage section.
Enabling this option allows you to dynamically attach instances of this symbol to your
Flash documents during runtime.
11.
Enter an identifier value of
animal_id
, and set the ActionScript 2.0 Class to
Animal
(to
match the class name specified in step 3).
12.
Select the Export in First Frame check box and click OK to apply your changes and close
the dialog box.
13.
Save the Flash document and select Control > Test Movie.
The Output panel displays the text from your Animal class’s constructor function.
Compiling and exporting classes
By default, classes used by a SWF file are packaged and exported in the SWF file’s first frame.
You can also specify a different frame where your classes are packaged and exported. This is
useful, for example, if a SWF file uses many classes that require a long time to download (such
as components). If the classes are exported in the first frame, the user has to wait until all the
class code has downloaded before that frame appears. By specifying a later frame in the
timeline, you could display a short-loading animation in the first few frames of the timeline
while the class code in the later frame downloads.
To specify the export frame for classes for a Flash document:
1.
Select File > New and then select Flash Document. Save the new document as
exportClasses.fla
.
NO
TE
If you need to modify the Movie Clip’s Linkage properties, you can right-click the
symbol in the document’s library and select Properties or Linkage from the context
menu.
Summary of Contents for FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Page 1: ...Learning ActionScript 2 0 in Flash...
Page 8: ...8 Contents...
Page 18: ...18 Introduction...
Page 30: ...30 What s New in Flash 8 ActionScript...
Page 66: ...66 Writing and Editing ActionScript 2 0...
Page 328: ...328 Interfaces...
Page 350: ...350 Handling Events...
Page 590: ...590 Creating Interaction with ActionScript...
Page 710: ...710 Understanding Security...
Page 730: ...730 Debugging Applications...
Page 780: ...780 Deprecated Flash 4 operators...
Page 830: ...830 Index...