MACROMEDIA FLASH MX 2004-LEARNING FLASH Manual page 102

Learning flash
Table of Contents

Advertisement

Note: For more information about the attachMovie() method, see attachMovie() in the Flash
ActionScript Language Reference. Additionally, you can use the Flash ActionScript Language
Reference for information about ActionScript that allows you to manage depth;
getNextHighestDepth(), getDepth(), getInstanceAtDepth() are methods of the MovieClip
class. The DepthManager class allows you to manage the relative depth assignments of a movie
clip.
Specify movie clip Stage coordinates
In addition to the z axis for the movie clip, you must specify the x and y coordinates to place the
movie clip within the Stage area at runtime.
Press Enter or Return after the last line in the Script pane and type the following:
trio_mc._x = 275;
trio_mc._y = 200;
};
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.
In the Timeline, select Frame 1 of the Actions layer. Then click at the end of the following line
1.
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);
Press Enter or Return and type the following script, which unloads the movie clip when the
2.
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(){
_root.attachMovie("MCTrio", "trio_mc", 1);
trio_mc._x = 275;
trio_mc._y = 200;
102
Chapter 13: Add Interactivity with ActionScript

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-LEARNING FLASH and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flash mx 2004 - actionscript

Table of Contents