开发者

how to make the images appear one by one? flash as3

i'm trying to make my images appear one by one, but they come on screen all together :

for (var i=0; i<myImages.length; i++){
    myImages[i].alpha = 0;
    myImages[i].buttonMode = true;
    TweenLite.to(myImages[i], 1, {delay:.5, alpha:1});
}
开发者_Python百科

the delay is not the right option, do you have any idea?

thanks


Try this small variation:

for (var i=0; i<myImages.length; i++){
    myImages[i].alpha = 0;
    myImages[i].buttonMode = true;
    TweenLite.to(myImages[i], 1, {delay:(0.5*i), alpha:1});
}

When you set up many TweenLite tweens on different images, if the delay and the duration of all tweenings is the same, all images will show up on screen at the same time, don't you think? ;)

So the solution is to increment the delay of the tween as you loop through the images.


for (var i=0; i<myImages.length; i++){
    myImages[i].alpha = 0;
    myImages[i].buttonMode = true;
    TweenLite.to(myImages[i], 1, {delay:(i+1)*0.5, alpha:1});
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜