mcTween: Cascading tweens

I want to fade a series of pictures one after the other, such that they’ll loop around. I’m calling this a cascade.

So to do this, i’ve placed all of the image names into an array and I set all of their alpha properties to 100 to begin with. I think I then need a for loop that will iterate through the images, fading the image down to 0, waiting for a set period of time and then moving on.

Unfortunately, mcTween will fade all of the images at once in the for loop, so I need to prevent a tween from starting until the one before it has finished. I thought I could achieve this using a while loop and the isTweening property, but when I try and preview the flash movie it just gets into a recurring loop and the program hangs, and has to be exited.

What is the correct way to do this?


#include "mc_tween2.as"

var countInterval;
var images:Array = new Array();
images = [wine_mc, sunset_mc, poppies_mc, pool_mc, eastView_mc]

wine_mc._alpha = 100;
eastView_mc._alpha = 100;
pool_mc._alpha = 100;
sunset_mc._alpha = 100;
poppies_mc._alpha = 100;

for(var i = 0; i < images.length; i++){
    _root[images*].alphaTo(0,1,"linear")
    while(_root[images*].isTweening()) {
        //do nothing
    }
}

I haven’t gotten around to pausing between tweens, but I believe I used setInterval to pause execution before. I seem to remember someone telling me that this isn’t the best way to pause execution anymore. Can anyone clarify this?

many thanks!
Daf