Example of controlling a Flash Movie with JavaScript:
Example: Int
123b: To see a more complex example of HTML links controlling
a number of Flash Movies click here
Step One: Creating the Flash Movie
Open a new: Flash Movie
Create a several animated: Movie Clips
Drag these Movie Clips out of the Library and place them on the: Main Stage
Cross Ref: If you do not know how to create an animated Movie Clip and place it on the Main Stage, you may wish to look at one of the following tutorials: Tween within Tween or Symbol: Movie Clip or Graphic
In the Property Inspector give each one its own: Instance Name
Export the Flash Movie. File > Export > Export Movie (Short Cut Key: Ctrl + Shift + Alt + S)
Note: Do not use spaces in the file name.
Before you save and close your Flash Movie, check the width
and height: Modify > Document(Short Cut Key: Ctrl + J)
Step Two: Creating the Web page
Open your favourite web editor such as Dreamweaver.
Create a new web page.
Save this page to an appropriate folder: Save
Place the Flash Movie (swf file) file (that you created in step 1.5 above) in the same folder as your web page.
Note: You may need to use My Computer,
or some similar file management program to do this.
Using the code edit mode (or Windows
Note Pad) in your web
editor, add your Flash Movie to your web page by using the code below:
Note: Use the same number as you did when
you loaded the Movie.
Know Issues:
Use "_level0 " when
referring to just the main time line and "_level0/InstanceNameOfMC" when
referring to a Movie Clip. The InstanceNameOfMC is
whatever the Instance Name of the Movie Clip is, in the Property Inspector,
in Flash (you need to type in the Instance Name).
You must give each Movie Clip an instance name that is individual and unique.
Do not use spaces with Instance Names and do not start the name with a number.
Sometimes when using the go to frame label or number, you
may need a play(); action script code on that label or frame, as the Movie
might not always automatically play when going to a different frame and label.
However most of the time it should be okay. You
can use something like this:
Go to
and play or stop at a specific frame label or frame number:
<a href='javascript:example.TGotoAndPlay("_level0/InstanceNameOfMC", "NameOfLabelOrFrameNumber")'>Goto
And Play Method</a>
<a href='javascript:example.TGotoAndStop("_level0/InstanceNameOfMC", "NameOfLabelOrFrameNumber")'>Goto
And Stop Method</a>
Note: I have never been able to get these methods work! So
it may or may not be possible to use these above methods. Please give any feedback on
the forum, and I will update this tutorial: Forum
For more tutorials on controlling Flash with JavaScript see
the site Index: A -
Z Index