Newsletter: Learn More ||| Multimedia Presentation Software |||
Load, Unload and Chain Wild FX Flash Text Effects in Macromedia Flash 5
Contents
Part 3
Movie Clips

Open Flash 5:

  1. Create a New movie. Modify Movie if needed to make it 550 by 400 pixels in size, and set the background color to be the same as you used when making your Wild FX animations.
  2. Click Window, point to Panel Sets, and choose Default Layout so that all the tools and palettes you might need are handy. Save this movie to your Desktop as loadtest.fla.
  3. Create a new movie clip and name it empty. Drag it onto the stage, and type empty_clip in the Name field on the Instance tab of the Instance panel.
  4. Right-click or control-click empty_clip. In Flash 5, one frame movie clips loop. So we can simply add our actions to empty_clip and it will loop by itself. Choose Actions from the context menu. The Object Actions dialog box opens.
  5. Since we want this movie clip to load ani1.swf when it loads, we need to add an OnClipEvent (load) action. You can either drill through all the icons in the left-hand pane of Object Actions to choose, or you can click the arrow on the upper right-hand corner of the dialog box and select Expert Mode, which will let you type or paste the code in directly. For our purposes, select Expert Mode and type or paste:
    onClipEvent (load) {
    loadMovieNum ("ani1.swf", 1);
    }
    This code tells empty_clip that when the main Flash movie, loadtest, starts up and loads it, empty_clip should in turn load ani1.swf into itself at the first level.
    Note: Since ani1.swf is a small thing, for our purposes, we don't have to worry about whether it's all loaded before it plays. However, you might need to ensure loading in other situations. In that case, you might want to getProperty on empty_clip's _width to ensure it's more than 0 before it plays. Or, since we're going to set a variable at the end of ani1.swf, you could check for that. We won't go any further into this now - that's another tutorial. Consider this just a heads-up.
  6. After empty_clip has loaded ani1.swf, empty_clip will enter its first frame and play. That's what our next section of code addresses:
    onClipEvent (enterFrame) {
    if (_level1.end == true) {
    loadMovie ("perf2a.swf", 1);
    }
    } else if (getTimer()>="10000") {
    unloadMovie (1);
    } endif;
    }
    Here we check for the end variable that we will soon set in ani1.swf. Since we loaded ani1.swf into level 1 of empty_clip, that's where the variable will be, which is why we address the variable in the code as _level1.end. Once the clip finds the variable, it means ani1.swf has played once to the end. So then we ask the movie to load our second movie, ani2.swf into _level1.
    For no particular reason, other than to demonstrate the technique, we then add a timer. Flash's getTimer() function counts the time the movie has been playing in milliseconds. The timer code line tells Flash that if the movie has been playing for 10 seconds or more, unload ani2.swf from level 1. Now although the movie clip loops, our set of animations will play only once and quit, due to the techniques we've used.
  7. Let's Save our work. Now we'll move on to adding the variable we need to ani1.swf.
  8. Create a New movie, and Import ani1.swf. Since this is a Flash 3 effect, we can do this easily. When ani1.swf loads, you'll see all the keyframes. Double-click on the last keyframe to open the Frame Actions dialog box, which is basically the same as the Object Actions we used earlier. Here we want to set our variable. You can choose set variable from the Actions list in the left-hand pane, or type or paste the code in Expert Mode:
    end = true
  9. Save this movie over itself, if you want, or Save As a new name and then rename it on the Desktop. Whatever you prefer. Close this movie window and return to loadtest. Publish loadtest. Before you run it, make sure that loadtest.swf, ani1.swf, and ani2.swf are all in the same place, either in a folder or on the desktop. Play loadtest and watch your animations load, play, and unload! Great, right? And much easier than you thought!
Top
This tutorial was written by FR Elkins.
 | Page 1 | Page 2 | Page 3 | Page 4
 
©2007 Wildform, Inc | Policies | Contact Us | Newsletter Options
 
©2010 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.