AS3.0等到补间完成

时间:2011-09-20 21:57:48

标签: actionscript-3 actionscript tween

当我点击我的按钮时,我希望其中一个mc完全消失(第一个alpha从1变为0)然后removeChild。

import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
main.btn.addEventListener(MouseEvent.CLICK, buttonClickHandler);

function buttonClickHandler(event:MouseEvent):void 
{

var aBlend = new Tween(main, "alpha", Strong.easeOut, 1, 0, 3, true);

aBlend.addEventListener(TweenEvent.MOTION_FINISH, end);   //doesnt work
}
function end()
{
    this.removeChild(mc);
}

我决定使用活动,但它不起作用,任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:2)

尝试按照此帖子的建议在buttonClickHandler之外移动aBlend声明:

http://www.actionscript.org/forums/showpost.php3?s=e4e6512ae627e7810c4e991691324b9f&p=735466&postcount=4

import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
main.btn.addEventListener(MouseEvent.CLICK, buttonClickHandler);

var aBlend;

function buttonClickHandler(event:MouseEvent):void 
{

aBlend = new Tween(main, "alpha", Strong.easeOut, 1, 0, 3, true);

aBlend.addEventListener(TweenEvent.MOTION_FINISH, end);   //doesnt work
}
function end(event:TweenEvent)
{
    this.removeChild(mc);
}