我有大约200张将在循环中运行的照片,在图像之间会有淡入淡出和淡出,是否有任何方法可以处理图像阵列或类似的东西所以我不这样做逐个为所有图像应用相同的动画?
我已经尝试过了,但它并不尊重我的setInterval
:
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.events.Event;
stage.addEventListener(Event.ENTER_FRAME, sendToBack);
function sendToBack(event:Event):void{
setInterval(function(){
setChildIndex(getChildAt(2), 0);
var my_mc = getChildAt(2);
getChildAt(1).visible = false;
getChildAt(0).visible = false;
TransitionManager.start(my_mc, {
type: Fade
});
}, 2000);
}
答案 0 :(得分:1)
我使用此代码获得了所需的结果:
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.events.Event;
var childsNum = numChildren,
frameInterval = 3000,
fadeDuration = 0.5;
function hideAll(){
var i;
for (i = 0; i < numChildren; i++) {
getChildAt(i).visible = false;
}
}
hideAll();
function animateFrame(){
var child = getChildAt(childsNum - 1),
myTM:TransitionManager = new TransitionManager(child);
myTM.startTransition({
type: Fade,
duration: fadeDuration
});
myTM.addEventListener("allTransitionsInDone", function(){
setChildIndex(getChildAt(childsNum - 1), 0);
getChildAt(1).visible = false;
});
}
setInterval(function(){
animateFrame();
}, frameInterval);