Accessibility

TechNote (Archived)

Differences between loadMovie and loadMovieNum

Introduction
Flash 5 ActionScript includes some new actions that are variations of older actions such as loadMovie and loadVariables These actions are listed below. Notice that each action is suffixed withNum.

loadMovieNum
unLoadMovieNum
loadVariablesNum
printNum
printAsBitmapNum

Note:These actions are not documented in the ActionScript Dictionary or Reference.

If authoring in Normal mode, the Flash authoring tool adds this suffix for you when needed. It's is not neccessary to decide whether to useloadMovieorloadMovieNum, and why. However, the automatically inserted code may be unfamiliar to new users, and must also be explained for those moving to Expert mode.

Purpose
These actions were included to deal with aloadMovieaction, for example, that references a variable name as the second function parameter. The second function parameter of this action can be either a target path (string) or a level number (integer). For example:

 loadMovie ("http://some.url.com/somemovie.swf", targetVar) 

When this code is interpreted, it's impossible for the Flash Player to know if the variabletargetVarcontains a string (target path) or integer value (level number). This potential ambiguity has been dealt with by splitting the loadMovie actioninto two separate actions: one, simply calledloadMovie, is used for loading a SWF into a target path; the other,loadMovieNum, is used when loading a movie into a level number.

For example, the following code would be used to load the designated movie into movie level 3,

 loadMovieNum ("http://some.url.com/somemovie.swf", 3) 

The following code would be used to load the movie into the target path, "_root.targetClip":

 loadMovie ("http://some.url.com/somemovie.swf", "_root.targetClip") 
 These same principles can be applied to each of the actions listed in the table at the top of this TechNote. 

Differences between Normal and Expert scripting modes
When creating ActionScript in Normal scripting mode these additional actions do not appear in the Toolbox list. Rather, the two separate actions appear under the standard name:loadMovie, for example. The distinction is made by Flash when the developer chooses between 'Level' and 'Target' in the Location drop-down menu in the Parameters pane. If 'Level' is chosen, the action changes toloadMovieNumin the actions list. If 'Target' is chosen then the action changes toloadMovie.

Note:when the Location parameter is set to 'Level' the 'Expression' box next to the Location field is in a checked state and disabled. This means that the Location field can contain a number or a variable, but not a string literal.So, if a number is typed into the Location field then the number will evaluate to itself, as it would in any expression. If a variable that contains a number is placed in the field then the variable will correctly evaluate to its assigned value.

In Expert scripting mode theloadMovieandloadMovieNumactions appear separately in the Toolbox list. Therefore,

When the 'Location' parameter is set to 'Level' the action readsloadMovieNum
When 'Location' is set to 'Target' the action readsloadMovie

it is up to the developer to know which action is appropriate. That is, if loading a movie into a level useloadMovieNumand if loading a movie into a target path useloadMovie .

In Expert scripting mode both actions appear separately in the Toolbox list::

Note:the string '_level3' is considered a target path to level 3. Therefore,loadMoviecan be used, carefully, to load movies into both target paths and movie levels. For example, the following action

loadMovie ("http://some.url.com/somemovie.swf", "_level3")

wouldload the designated movie into level 3.



AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Creative Commons License

Search Support


Document Details

ID:tn_14690

Products Affected: