SLIDE SHOW WITH SCRIPTED DELAY Illustrated here is a basic technique for streaming a large SWF with minimal download time before play starts. Content is divided into movie clip groups (MCGs) which each occupy a single frame of the composition timeline. A SWF will play as soon as the entire content of its first frame has downloaded, and in this example, that content is the first MCG. While the first MCG plays, the next has plenty of time to download, and the entire show downloads ahead of the play rate in a similar manner. In order to save on the number of frames, we'll stop each MCG for the time in which no animation is required. We'll do that with a single timer script, or "delay machine." Here's the overall logic: 1) A script keyframe stops the composition timeline from playing on its own. 2) The first slide MCG downloads completely and animates to full opacity in its own timeline. 3) At the 100% opacity point, a script keyframe stops the MCG and plays the delay machine. 4) After the designated number of frames have elapsed, the delay machine restarts the MCG and resets itself. 5) The MCG animates to zero opacity and advances the composition timeline to the next frame, where the process repeats for the second slide MCG. Instead of listing all the MCGs in the delay script, we'll use a variable named "target" in the composition onLoad event handler. A line in the same script keyframe that stops each MCG and starts the delay machine changes the value of target to its own name, identifying it as the MCG to restart when the delay machine times out. The delay script works by incrementing a counter variable once per frame, and restarting the target MCG once the counter reaches a certain value. Just to keep things tidy, we've initialized the counter in the composition onLoad handler as well. Here's what we have in that handler: var counter = 0; var target; We give the counter an initial value to give the delay script something to evaluate. Because the delay script must increment the counter once per frame, we use an onEnterFrame handler to house the script. The drawback is that the script consumes CPU cycles, so we need to turn it off completely when not in use. This is done by using a one-frame, empty MCG to house the script, and enclosing it in a two-frame controller MCG so that it occupies only the second frame of the controller. When the controller is in the second frame, the script executes; when in the first frame, the script essentially does not exist in the composition. To start the delay script, we simply play the controller from each slide MCG's 100% opacity script keyframe. Here's what's in that script: stop(); //stop the MCG at 100% opacity _root.delay_control.play(); //start the delay script _root.target = _root.slide1; //MCG identifies itself After timing out, the delay script removes itself from the composition by sending the controller to a label in its first frame. Here's the delay script: if (_root.counter < 120) { _root.counter++; //increase counter by 1 until it reaches 120 } else { //then... clip = _root.target; //check which clip is the current target clip.play(); //play the target clip _root.counter = 0; //reset counter to 0 _parent.gotoAndStop("f0"); //send controller to the first frame } In our example, we've looped the entire slide show. Each MCG sends itself back to its first frame using a gotoAndStop("label") method, and we've added one frame to the end of the composition timeline with a similar script. Many thanks to Bo Nielsen for helping debug the scripts! --Phil S. phil@idexworks.com