Newsletter: Learn More ||| Multimedia Presentation Software |||
Smart Preloader for Wild FX Effects
Contents
Download the .fla and .swfs for this tutorial
Top
Introduction
This FLA is a new and easier preloading system for Wild FX effects. With this user-friendly method, there is no need to adjust script -- it's a "smart-loader".
 
Top
Step One
In the first frame of the main timeline, define the names of the external .swf files which will need to be loaded. You will find the following actionscript:

Set Variable: "swf1" = "external1.swf"
Set Variable: "swf2" = "external2.swf"
Set Variable: "swf3" = "external3.swf"
Set Variable: "swf4" = "external4.swf"


You are not bound to use these names, but remember that the Movie Clip containers (see explanation below) will search for the value of Wild FX (where X is the number) according to their instance name (e.g. external2 or external7 etc). If you have not defined this particular Wild FX value, the movie will "hang" (i.e. get stuck in a infinite check/load loop).

In the next 3 frames you see a simple system / loop which checks if the main movie is completely loaded. (It checks to see if frame with label "end" is loaded). If it is, then it plays label "go".
Top
Step Two
Once the first step is complete, in the following frames the according Movie Clip "external" is placed as many times as you need to show/load external .swf's. The instance names are named numerically (e.g. external1, external2, etc.) and will load the external .swf based on its name. (It uses a substring actionscript to see what its name is and loads the value of swf+"that_number", where "that_number" is the number of the Movie Clip instance (e.g. external4 will load the value of swf4). Since you defined these values in frame 1 of the main timeline, it will read this value and load this particular .swf file.

Notice that all instances of MC 'external' are placed on their own layer. This makes it very easy to fade them out by motiontweening or alphatweening and it maintains a better editing overview.

Also notice that they appear on stage/keyframe in sequence. The preloading system is based on this sequesnce. The MC 'external' is a self-preloading movieclip. You should not start more than one on the same keyframe because every movieclip does the following -->
  1. pause the main timeline
  2. wait till the appropriate external .swf is loaded
  3. tell the main timeline to continue playing
If you start more than one at the same keyframe, then it will start the main timeline as soon as one of them is loaded. This may lead to effects not showing up when they are told to (see next step) because they may not have fully preloaded.
Top
Step Three
In the main timeline, to start one of the external .swf's simply add the actionscript telling it to play. For example, this code will tell MC external4 to play:

Begin Tell Target ("/external4")
Play
End Tell Target


That's about it. In the .FLA accompanying this tutorial, you can also see how to use simple motion tween or alpha tween/fade to the loaded .swf. (Remember that this can only be done so easily, because you use a MC and not a level to load into.)

Have fun.
Top
 
©2008 Wildform, Inc | Policies | Contact Us | Newsletter Options
 
Wildform provides a 100% satisfaction guarantee on all our Flash software. If you are not completely satisfied with our Flash multimedia software for any reason you may request a refund within 15 days of purchase.