03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

You could add the following code to load a JPEG image called image1.jpg from the same<br />

directory as the SWF file loading sub.swf. The JPEG is loaded when you click a button called<br />

myBtn_btn. This code loads the JPEG into logo_mc. Therefore, it will replace sub.swf with<br />

the JPEG image.<br />

myBtn_btn.onRelease = function(){<br />

loadMovie("image1.jpg", logo_mc);<br />

};<br />

Usage 2: The following example loads the SWF file circle.swf from the same directory <strong>and</strong><br />

replaces a movie clip called mySquare that already exists on the Stage:<br />

loadMovie("circle.swf", "mySquare");<br />

See also<br />

_level property, loadMovieNum function, loadMovie (MovieClip.loadMovie<br />

method), loadClip (MovieClipLoader.loadClip method), unloadMovie function<br />

loadMovieNum function<br />

loadMovieNum(url:String, level:Number [, method:String]) : Void<br />

Loads a SWF or JPEG file into a level in Flash Player while the originally loaded SWF file<br />

plays.<br />

TIP<br />

If you want to monitor the progress of the download, use<br />

MovieClipLoader.loadClip() instead of this function.<br />

Normally, Flash Player displays a single SWF file <strong>and</strong> then closes. The loadMovieNum()<br />

action lets you display several SWF files at once <strong>and</strong> switch among SWF files without loading<br />

another HTML document.<br />

If you want to specify a target instead of a level, use loadMovie() instead of<br />

loadMovieNum().<br />

Flash Player has a stacking order of levels starting with level 0. These levels are like layers of<br />

acetate; they are transparent except for the objects on each level. When you use<br />

loadMovieNum(), you must specify a level in Flash Player into which the SWF file will load.<br />

When a SWF file is loaded into a level, you can use the syntax, _levelN, where N is the level<br />

number, to target the SWF file.<br />

When you load a SWF file, you can specify any level number <strong>and</strong> you can load SWF files into<br />

a level that already has a SWF file loaded into it. If you do, the new SWF file will replace the<br />

existing SWF file. If you load a SWF file into level 0, every level in Flash Player is unloaded,<br />

<strong>and</strong> level 0 is replaced with the new file. The SWF file in level 0 sets the frame rate,<br />

background color, <strong>and</strong> frame size for all other loaded SWF files.<br />

56 ActionScript language elements

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!