Preloading movies is a useful optimizing and authoring technique. Preloaded movies can also be "parked", which allows you to control when they stop or play. The tutorial assumes that you are familiar with the basic concepts of ActionScript and how to preload movies, as discussed in How to create movies that download before playing (TechNote 12588).


Download Windows source file (36K)

Download Macintosh source file preload_level.sit (40K)

To park a preloaded movie do the following:


In the movie being preloaded, or external movie, insert a blank keyframe in the first frame of the main Timeline and add astopaction to that frame. This will prevent the movie from playing right away, making it initially "invisible".

2 In the main Flash movie, insert a keyframe and add aloadMovieaction to that frame that loads the external movie into a level, in this case level 1. This frame action will load the movie automatically when the playhead passes the frame in the main timeline.
3 Once the movie has finished preloading, use specific target paths to stop or play the loaded movie. For example: on (release) { if(_level1._framesLoaded == _level1._totalframes) { _level1.gotoAndPlay ( 2 ) ; } } To "deactivate" the parked movie, or send it back to the empty keyframe, use a similargotoAndPlayaction to send the loaded movie to frame 1, which contains no content.

Additional Information

This technique is similar to that discussed for movie clips in How to 'park' a movie clip so it can be preloaded and reused (TechNote 14404). For information on using the loadMovie action see How to use Load Movie action (TechNote 14190).

Keywords: tn_15737

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy