Flash Script – Load a Movie in Flash


type = 'application/x-shockwave-flash'
data = 'http://sitepointstatic.com/flash/loadmovie.swf'
width = '400'
height = '400'
bgcolor = 'black'
>

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 book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

No Reader comments

Comments on this post are closed.