122
Syntax and Language Fundamentals
6.
Type the following ActionScript after the code you added in step 3:
rotateClip.loadMovie("http://www.helpexamples.com/flash/images/
image1.jpg");
This code loads an image into the rotateClip movie clip that you created with code. You’re
targeting the rotateClip instance with ActionScript.
7.
Select Control > Test Movie to test your document.
Now you should see an image on the Stage that rotates 50º clockwise.
You can also target or identify parts of SWF files that you load into a base SWF file.
To identify a loaded SWF file:
■
Use
_level
X
, where
X
is the level number specified in the
loadMovie()
function that
loaded the SWF file.
For example, a SWF file loaded into level 99 has the target path
_level99
. In the
following example, you load a SWF file into level 99 and set its visibility to
false
:
//Load the SWF onto level 99.
loadMovieNum("contents.swf", 99);
//Set the visibility of level 99 to false.
loaderClip.onEnterFrame = function(){
_level99._visible = false;
};
Setting variables using a path
You can set variables for instances that you nest inside of other instances. For example, if you
want to set a variable for a form that’s inside another form, you can use the following code.
The instance submitBtn is inside of
formClip
on the main timeline:
this.formClip.submitBtn.mouseOver = true;
You can express a method or property of a particular object (such as a movie clip or text field)
using this pattern. For example, the property of an object would be
myClip._alpha = 50;
TIP
It’s generally a good idea to avoid using levels if you can load content into movie clips
at different depths instead. Using the
MovieClip.getNextHighestDepth()
method
enables you to create new movie clip instances on the Stage dynamically without
having to check whether there is already an instance at a particular depth.
Summary of Contents for FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Page 1: ...Learning ActionScript 2 0 in Flash...
Page 8: ...8 Contents...
Page 18: ...18 Introduction...
Page 30: ...30 What s New in Flash 8 ActionScript...
Page 66: ...66 Writing and Editing ActionScript 2 0...
Page 328: ...328 Interfaces...
Page 350: ...350 Handling Events...
Page 590: ...590 Creating Interaction with ActionScript...
Page 710: ...710 Understanding Security...
Page 730: ...730 Debugging Applications...
Page 780: ...780 Deprecated Flash 4 operators...
Page 830: ...830 Index...