How to step through an array (displaying a moveclip, then fading out)?
Sorry in advance: I'm a beginner.
I created 10 movie clips, set up the linkage so each exports to ActionScript, created an array of all 10, typed up the addChild row so it loads my movie clips on the stage, and now have to display each one then fade it out (one by one). I've tried two for loops listed in my Classroom In A Book textbook, but my .swf only shows whatever image is on top with no change or has them all fade together into a mess of drawings. My two attempted codes follow. Can someone tell me what I'm missing to get them to go oneself at a time?
Attempt 1:
import flash.display.MovieClip;
import fl.transitions.Tween;
import fl.transitions.easing.*;
//Create an array of the 10 movie clips.
var clipArray:Array = new Array (One,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten);
//Create an array of the movie clips on the stage.
var clipsOnstage:Array = new Array();
//Add the clips to the stage at a random order, one by one, until all 10 (and only 10) are on the stage
for (var i:int = 0; i < 10; i++) {
var pickClip = clipArray[int(Math.random() * clipArray.length)];
var clip:MovieClip = new pickClip();
addChild(clip);
clip.x = 158;
clip.y = 158;
}
//Add a function to the stage that steps through the clips, one by one.
stage.addEventListener(Event.ENTER_FRAME, showClip);
//Detail what I want that function to do.
function showClip(e:Event):void {
for (var i:int = clipsOnstage.length-1; i > -1; i--) {
//For the current movie clip displayed, fade it out, but don't display the next one until the first one is faded out.
var currentClip:MovieClip = clipsOnstage;
var tweenFadeOut:Tween = new Tween(currentClip, "alpha", None.easeOut, 1, 0, 3, true);
}
}
Attempt 2:
import flash.display.MovieClip;
import fl.transitions.Tween;
import fl.transitions.easing.*;
//Create an array of the 10 movie clips.
var clipArray:Array = new Array (One,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten);
//Create an array of the movie clips on the stage.
var clipsOnstage:Array = new Array();
//Add the clips to the stage at a random order, one by one, until all 10 (and only 10) are on the stage.
for (var i:int = 0; i < 10; i++) {
var pickClip = clipArray[int(Math.random() * clipArray.length)];
var clip:MovieClip = new pickClip();
addChild(clip);
clip.x = 158;
clip.y = 158;
var tweenFadeOut:Tween = new Tween(clip, "alpha", None.easeOut, 1, 0, 12, true);
}