- Creating Sliding Panels for Navigation and Transition Effects
- Other Uses of the Slide Algorithm
- Multiple Mouse Slide
- Coding the Multiple Movement Algorithm
- Using Functions to Make Efficient Code
- Passing Parameters to Functions
- Duplicating the Movie Clip On-the-Fly
- Adding Scale to the Effect
- The Sliding Mask Transition Effect
- Creating the Function for X and Y Movement
- Adding to the Transition Effect
Adding Scale to the Effect
Before you test the movie, add the following piece of code into the movePanel function as the last line:
_root[whichClip]._xscale = rate;
This will have the effect of scaling down the xscale of each panel as it moves to its final resting place (remember the value of rate is constantly decreasing). This creates quite a good transition effect, but play with it to suit your taste.
Now test your movie. You should see 10 panels move across the stage to where the mouse rests, all with varying degrees of speed (see Figure 3.20).
Figure 3.20. This test gives you 10 panels in a parade on your screen, but it is easy to add more.
Do you want more than 10 panels? No problem. Simply increase the number in the for loop. For instance, if you want 20 panels, just change the condition in the for loop to the following:
loopCount < 20;
This is the real beauty of designing with ActionScript. By changing just a few numbers, you can create different effects, quickly and easily. You can see how we have taken one basic slide algorithm, and used it not just for navigation, but also for visual effects. But there's still more you can do!