View comments | RSS feed

loadMovieNum function

loadMovieNum(url:String, level:Number, [method:String]) : Void

Loads a SWF, JPEG, GIF, or PNG file into a level while the original SWF file is playing. Support for unanimated GIF files, PNG files, and progressive JPEG files is added in Flash Player 8. If you load an animated GIF, only the first frame is displayed.

Tip: If you want to monitor the progress of the download, use MovieClipLoader.loadClip() instead of this function.

Normally, Flash Player displays a single SWF file and then closes. The loadMovieNum() action lets you display several SWF files at once and switch among SWF files without loading another HTML document.

If you want to specify a target instead of a level, use loadMovie() instead of loadMovieNum().

Flash Player has a stacking order of levels starting with level 0. These levels are like layers of acetate; they are transparent except for the objects on each level. When you use loadMovieNum(), you must specify a level in Flash Player into which the SWF file will load. When a SWF file is loaded into a level, you can use the syntax, _levelN, where N is the level number, to target the SWF file.

When you load a SWF file, you can specify any level number and you can load SWF files into a level that already has a SWF file loaded into it. If you do, the new SWF file will replace the existing SWF file. If you load a SWF file into level 0, every level in Flash Player is unloaded, and level 0 is replaced with the new file. The SWF file in level 0 sets the frame rate, background color, and frame size for all other loaded SWF files.

The loadMovieNum() action also lets you load JPEG files into a SWF file while it plays. For images and SWF files, the upper left corner of the image aligns with the upper left corner of the Stage when the file loads. Also in both cases, the loaded file inherits rotation and scaling, and the original content is overwritten in the specified level.

Note: JPEG files saved in progressive format are not supported.

Use unloadMovieNum() to remove SWF files or images that were loaded with loadMovieNum().

When using this method, consider the Flash Player security model.

For Flash Player 8:

For Flash Player 7 and later:

For more information, see the following:

Availability: ActionScript 1.0; Flash Player 4 - Flash 4 files opened in Flash 5 or later are converted to use the correct syntax. The ability to load JPEG files is available as of Flash Player 6. The ability to load unanimated GIF files, PNG files, or progressive JPEG files is available as of Flash Player 8.

Parameters

url:String - The absolute or relative URL of the SWF or JPEG file to be loaded. A relative path must be relative to the SWF file at level 0. For use in the stand-alone Flash Player or for testing in test mode in the Flash authoring application, all SWF files must be stored in the same folder and the filenames cannot include folder or disk drive specifications.

level:Number - An integer specifying the level in Flash Player into which the SWF file will load.

method:String [optional] - Specifies an HTTP method for sending variables. The parameter must be the string GET or POST . If there are no variables to be sent, omit this parameter. The GET method appends the variables to the end of the URL and is used for small numbers of variables. The POST method sends the variables in a separate HTTP header and is used for long strings of variables.

Example

The following example loads the JPEG image tim.jpg into level 2 of Flash Player:

loadMovieNum("http://www.helpexamples.com/flash/images/image1.jpg", 2);

See also

unloadMovieNum function, loadMovie function, loadClip (MovieClipLoader.loadClip method), _level property


Version 8

Comments


William_Donelson said on Mar 1, 2006 at 10:31 PM :
IMPORTANT NOTE: You may NOT use or access the resulting movie from "loadMovieNum(...)" until AFTER the movie has loaded !!! This is unclear from the documentation above.

Example:
--------------------------------
loadMovieNum("foo.swf", 1);
//
_root.onEnterFrame = function()
{
if (_level1.getBytesLoaded() == _level1.getBytesTotal() && _level1._width>10)
{
_level1._xscale = 200;
delete _root.onEnterFrame;
}
};
No screen name said on Mar 8, 2006 at 12:09 PM :
There URL argument is incorrect. It must be relative to the HTML file that has loaded the SWF file (assuming the SWF and HTML files are not in the same directory).

Also, the Level argument doesn't work with the described _level0, etc... it only works with an integer. The _level0, etc works with loadMovie()
wimadafurst said on Mar 26, 2007 at 12:13 AM :
wishing to see info on error handling for loadmovie on this page. e.g. are ther any parms returned if the open fails?
No screen name said on May 30, 2007 at 3:40 PM :
The documentation of loadMovieNum function would be more helpfull if it could explain how to pass a variable to be used in the swf loaded.
No screen name said on May 31, 2007 at 2:39 PM :
If you replace level 0 with LoadMovieNum, do global variables stay constant, or are they erased when the old Level 0 is unloaded?
No screen name said on Jul 1, 2007 at 1:53 PM :
Hi guys,

how can I load a movie and start it from different frame rather than first frame.

LoadMovieNum("mc.swf", 20).gotoAndPlay(10)

is this possible? if not how can i achieve this?

Thanks.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00001740.html