
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Defining Components
|
409
3. Rename Layer 1 to sharedCode.
4. Select File
➝ Open As Library, and choose codeLibrary.fla. The codeLibrary.fla
Library appears.
5. From the codeLibrary.fla Library, drag an instance of the sharedFunctions clip
onto the Stage at frame 1 of myMovie.fla.
6. Name the instance
sharedFunctions.
7. On the main timeline of myMovie.fla, create a new layer called scripts.
8. Add a keyframe to the scripts layer at frame 2.
9. Add a new frame to the sharedCode layer.
10. On frame 2 of the scripts layer, attach the following code:
stop();
sharedFunctions.test();
11. Export myMovie.swf.
12. The following text appears in the Output window: “The shared function, test,
was called.”
Note that a shared library is a linked asset, much like a .gif image is linked to a .html
file. Therefore, shared library .swf files must always be uploaded correctly with the
files that use them. To change the location of a link from an imported symbol to a
shared library, follow these steps:
1. Select the symbol in the Library.
2. From the Library panel’s pop-up Options menu, choose Linkage.
3. Under URL, set the new location.
Defining Components
A component is a movie clip that allows some of its properties to be assigned
through a special graphical user interface in the Flash authoring tool. Components ...