What is a level?
Added: 31 Jan 2009. Working example for Java.
Just in the same way that the display list is organised into layers to control the order in which objects are displayed so the Flash Player also supports the concept of levels so that if you want to display more than one movie (or movie clip) you can set the order in which they are displayed.
Levels are numbered from 0 upwards. Level 0 is the level on which the main movie is loaded. A movie loaded into level 1 will be displayed in front of the main movie. Movies on a higher level are displayed in front of movies loaded on a lower level.
Movies are loaded using the loadMovieNum() function in Actionscript.
The equivalent set of actions if you implement the function instead of using Translate are:
Push.Builder builder = new Push.Builder(); builder.add("movie.swf"); builder.add("_level1"); actions.add(builder.build()); actions.add(new GetUrl2(GetUrl2.MOVIE_TARGET));
If you load a movie to an existing level then the movie at that level is replaced by the new one. You can completely replace the main movie by loading a new movie to level 0. This will replace all the movies you loaded onto other levels as well. The background colour will not be changed from the one defined in the original movie however - the working example, BasicLevels.java illustrates this.
Position & Background
When you load a new movie everything is drawn from the origin of the screen in the top left corner, just as if the movie was played normally. You do not have any control over where the movie is positioned so ideally movies which are designed to be overlaid on different levels should at least be the same size to make aligning the objects easier.
Also when you load a movie into a level the background is set to be transparent. Any background colour defined in the movie is ignored, otherwise movies on a lower level would be hidden by the movie on the highest level.