PDA

View Full Version : Fade-in movie clips in sequence?


guru212
08-26-2004, 02:16 AM
Hey guys,

I have a FMX movie where I would like them to fade-in in a defined sequence.

I would like the first movie to fade-in, then after .5 seconds the second and then the third.

How do I do this?

madgett
08-26-2004, 06:51 AM
There's a lot of ways you could do this, but I would do it this way: first create 1 movie that fades in. Give it an instance name. Make an actions layer. Use the duplicateMovieClip() method on that 1 instance. And then use the setInterval() event to call a function containing the duplicateMovieClip() method every .5 seconds.

Look something like this:

var i:Number = 0; // counter
function duplicateFadeClip() {
var clip:MovieClip = fadeClipToDuplicate_mc.duplicateMovieClip("fadeClip"+i, this.getNextHighestDepth()); // search the help for duplicateMovieClip to see all the parameters accepted by this method
clip.gotoAndPlay("frame where fading starts"); // this assumes you have a "stop();" command on your timeline of the fade clip being duplicated
++i; // increment the counter (so duplicated clips have different instance names
}
setInterval(duplicateFadeClip, 500); // setInterval(function, time in milliseconds));


This is one of the most elementary examples of what you are trying to do...you can add much more to make this more dynamic.

guru212
08-28-2004, 03:01 AM
Thanks Madgett! That's what I was looking for!