|
|
||||
|
|
Ultrashock Tutorials > Flash5 > Working with Flash5 levels | |||
|
||||
|
|
Working with Flash5 levels |
|
||
|
Stacking up One of the great features of the flash player is that it can play multiple .swf files at a time. These files can be loaded and unloaded through actionscript. Once you are familiar with the basics of levels you can move to to look at how to build entire sites where all the content is displayed through the interaction of flash files playing together in a single player window. Targetting across levels To target another level you must use an identifier plus an absolute target. The identifier looks like "_level5" where 5 refers to the level containing the flash movie. So a typical target might be _level5.instance1 (in the old slash syntax - "_level5/instance1"). You can also use this syntax for getting or setting variables across levels. This statement, for example, sets a local variable called name to the value of username stored in level5. name = _level5.username; You can exploit this to keep a record of information while the user navigates through a multi-level site. Load an empty flash file and use it as a placeholder for variables such as a username, score, or setup values. You can swap out the other files contain the visual content but always access those variables by targeting the placeholder level. Using SetProperty with levels One thing many flash folks are not aware of is that it is possible to issue SetProperty actions on an entire level. In this sample you'll see that you can control a level as if it were a movie clip.
The base tag If you are keeping your flash files in a separate directory than your html files (such as is the case with this page) you can run into trouble with the load movie action. The optional base tag is used in the object and embed tags to let the player know where to look for urls referred to inside the flash file. Adding a BASE="." tag will ensures that the url used in a load movie action is relative to the first .swf file loaded. Partially loaded files Remember that it will take a moment for the player to stream in each new file. You will run into trouble if you try and reference any variables or frame labels that have not had a chance to load yet. Setting properties on a level will not work unless that level has had a chance to load. Frame rates The frame rate is always the same for all levels in the flash player. The frame rate of the initial movie is used even when loading other movies with different frame rates. Background and positioning Movies loaded onto new levels are alligned according to their top left corners. One of the downsides of designing with levels is that you are working with two separate flash files and it can be hard to design a unified looking interface that way. Often it makes sense to work in a single flash file and then copy out the layers you want to exist in separate files when you are done. It is also a good idea to always work with flash files of the same size so that you don't have to worry about positioning. The background colour which is set in the Movie Properties dialog box only applies for the base movie. The background of loaded movies is dropped out.
|
||||
|
|
©2001 Ultrashock.com Inc. - All rights reserved
|
|