EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 363

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Creating movie clips at runtime 363
3. In the Library panel, select Linkage from the Library panel pop-up menu.
The Linkage Properties dialog box appears.
4. For Linkage, select Export for ActionScript.
5. For Identifier, enter an ID for the movie clip.
By default, the identifier is the same as the symbol name.
You can optionally assign an ActionScript class to the movie clip symbol. This lets the
movie clip inherit the methods and properties of a specified class. (See Assigning a class to
a movie clip symbol” on page 378.)
6. If you don’t want the movie clip to load before the first frame, deselect the Export in First
Frame option.
If you deselect this option, place an instance of the movie clip on the frame of the timeline
where you want it to be available. For example, if the script youre writing doesnt reference
the movie clip until Frame 10, place an instance of the symbol at or before Frame 10 on
the Timeline.
7. Click OK.
After youve assigned a linkage identifier to a movie clip, you can attach an instance of the
symbol to the Stage at runtime by using
attachMovie().
To attach a movie clip to another movie clip:
1. Assign a linkage identifier to a movie clip library symbol, as described in the
previous example.
2. With the Actions panel open (Window > Actions), select a frame in the Timeline.
3. In the Actions panel’s Script pane, type the name of the movie clip or level to which you
want to attach the new movie clip.
For example, to attach the movie clip to the root timeline, type this.
4. In the Actions toolbox (at the left of the Actions panel), select ActionScript 2.0 Classes >
Movie > MovieClip > Methods, and select
attachMovie().
5. Using the code hints that appear as a guide, enter values for the following parameters:
For idName, specify the identifier you entered in the Linkage Properties dialog box.
For newName, enter an instance name for the attached clip so that you can target it.
For depth, enter the level at which the duplicate movie clip will be attached to the
movie clip. Each attached movie clip has its own stacking order, with level 0 as the
level of the originating movie clip. Attached movie clips are always on top of the
original movie clip, as shown in the following example:
this.attachMovie("calif_id", "california_mc", 10);

Table of Contents

Related product manuals