Problem – instead of cycling through the images in the array, it jumps right to the last one.
import fl.transitions.Tween;
import fl.transitions.easing.*;
play_btn.addEventListener(MouseEvent.CLICK, goPlay)
var images = new Array();
images[0] = "1.jpg";
images[1] = "2.jpg";
images[2] = "3.jpg";
images[3] = "4.jpg";
images[4] = "5.jpg";
images[5] = "6.jpg";
images[6] = "7.jpg";
images[7] = "8.jpg";
images[8] = "9.jpg";
images[9] = "10.jpg";
var currentImage:int = 0;
function goPlay(e:MouseEvent):void {
while (currentImage < 10) {
loadWindow.source = images[currentImage];
currentImage++;
var myTween:Tween = new Tween(loadWindow, "alpha", None.easeOut, 1, 0, 3, true)
}
}
Here’s your problem
on goPlay, you cycle through all of them, and end at the last one
essentially you are doing this
which becomes
so every time you click, only the last image gets added
you need to define the variable i outside the function
something like this
hope it’s clear
if you want the animation to happen automatically (After pressing the button)…