Web
Article

Flash Script – Load a Movie in Flash

By Georgina Laidlaw


Download the sample files here.

Note that in this tutorial, I’ll assume that you know how to create a button.

1. Create two buttons, one labelled "Load movie1", the other labelled "LoadMovie2".

2. Create a new blank movie clip — a clip with no objects in it.

3. Give this new blank movie clip an instance name of "dummy".

4. Right click the "load movie1" button, select "actions", and insert the following:

on (release) 
{
loadMovie ("mov1.swf", "/dummy");
}

This code loads the swf file called mov1.swf into target "/dummy". You can replace this reference with on to you own swf file, which should be located in the same directory.

5. Right click the "load movie2" button, select "actions", and insert this action:

on (release) 
{
loadMovie ("mov2.swf", "/dummy");
}

Press ctrl+enter to test the movie.

The load movie syntax is:

loadMovie(url [,location/target, variables]]);

url: the path of the file.

location/target:

location: an optional argument that specifies the level into which the movie is loaded.

The loaded movie inherits the position, rotation, and scale properties of the targeted movie clip.

variables: an optional argument that specifies a method for sending variables associated with the movie to load.

The argument must be the string "GET" or "POST." Omit these if there are no arguments.

Free Guide:

7 Habits of Successful CTOs

"What makes a great CTO?" Engineering skills? Business savvy? An innate tendency to channel a mythical creature (ahem, unicorn)? All of the above? Discover the top traits of the most successful CTOs in this free guide.

No Reader comments

Recommended
Sponsors
Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in Front-end, once a week, for free.