EasyManua.ls Logo

MACROMEDIA FLASH 8-FLASH - Page 242

MACROMEDIA FLASH 8-FLASH
292 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...
242 ActionScript: Add Interactivity
Unload the movie clip
After the movie clip plays, you need a way to remove the movie clip from
the Stage when the user goes to Scene 2. You can modify your script for the
goScene_btn to “unload” the movie clip.
1. In the Timeline, select Frame 1 of the Actions layer.
Then click at the end of the following line of script in the Script pane,
within the function that takes the user to Scene 2, to place the insertion
point:
gotoAndStop("Scene 2", 1);
2.
Press Enter (Windows) or Return (Macintosh) and type the following
script, which unloads the movie clip when the function runs, so that the
movie clip does not continue to play when the user goes to Scene 2:
unloadMovie("trio_mc");
Your entire function for the goScene_btn should appear as follows:
// This script takes user to Scene 2 when goScene_btn
// instance is released.
goScene_btn.onRelease = function() {
gotoAndStop("Scene 2", 1);
unloadMovie("trio_mc");
};
Your entire script should appears as follows:
// Stops the playhead at Frame 1.
stop();
// This script takes user to Scene 2 when goScene_btn
// instance is released.
goScene_btn.onRelease = function (){
gotoAndStop("Scene 2", 1);
unloadMovie("trio_mc");
};
// This function plays trio_mc when attachMovie_btn
// instance is released.
attachMovie_btn.onRelease = function(){
this._parent.attachMovie("MCTrio", "trio_mc", 1);
trio_mc._x = 275;
trio_mc._y = 200;

Table of Contents

Related product manuals