MACROMEDIA FLASH 8-FLASH Specifications Page 240

  • Download
  • Add to my manuals
  • Print
  • Page
    / 290
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 239
240 ActionScript: Add Interactivity
Play a movie clip
You can configure your document to play a movie clip at runtime. Using
the
attachMovie() method, you can attach an instance of a movie clip in
the Library panel to the Stage even though you have not placed an instance
on the Stage.
With the
attachMovie() method, you must export the symbol for
ActionScript and assign it a unique linkage identifier, which is different
from the instance name.
1. In the Library panel, right-click the MCTrio symbol and select Linkage
from the context menu.
2. In the Linkage Properties dialog box, select Export for ActionScript.
3. In the Identifier text box, verify that MCTrio appears as the
linkage name.
4. Verify that Export in First Frame is selected, and then click OK.
Movie clips that are exported for use with ActionScript load, by
default, before the first frame of the SWF file that contains them. This
can create a delay before the first frame plays. When you assign a
linkage identifier to an element, you can specify that the movie clip
loads on the first frame to avoid playback delays.
Use the attachMovie() method to play a
movie clip
You’ll now use the attachMovie() method to load the movie clip and
provide the symbol with an instance name. Since the instance of the
symbol does not exist on the Stage, you’ll create the instance name
programmatically.
1. In the Timeline, select Frame 1 of the Actions layer for Scene 1.
2. In the Script pane of the Actions panel, place the insertion point at the
end of your last line of code.
Press Enter (Windows) or Return (Macintosh), and then type the
following to add a comment and create a new function:
// function plays trio_mc when attachMovie_btn instance
// is released
attachMovie_btn.onRelease = function(){
Page view 239
1 2 ... 235 236 237 238 239 240 241 242 243 244 245 ... 289 290

Comments to this Manuals

No comments