Flash Templates Tutorials - Clip Upload and Duplication
Clip Upload and Duplication
1. Uploading and unloading the clips
Flash allows you to upload additional clips and play them using the special ActionScript actions. You can substitute current movie for another, or place the uploaded clips above or below the current movie assigning them to respective layer. In other words, you can create the superposable clips. You can upload JPEG images instead of the swf clips. You need to use loadMovie action to upload JPEG images or clips. This action uploads new clip (image) and replaces the current movie clip with it. The syntax of the action is as follows:
loadMovie("address of the clip of image", path to the clip it is uploaded to);
Please note, that new clip or image must be located at the same domain as the main movie. This limitation is set due to security reasons.
Samples of using loadMovie action:
loadMovieNum action is similar to loadMovie, but it loads clip and makes it superposable. Its second parameter determines the level of the clip.
loadMovieNum("address of the clip", level number)
loadMovieNum ("images/jpg/piano.jpg", 0)
First expression in example above loads the clip and places it at the first layer. The second expression replaces the clip with piano image. When the uploaded clip is not needed any more it is the right time to unload it. ActionScript language allows you to perform two actions: unloadMovie and unloadMovieNum. Both unload the movie clips uploaded with respective loadMovie and loadMovieNum actions. Below is the sample code:
unloadMovie(name of the clip or image);
unloadMovieNum(level of the clip);