AS3.0 wait until tween has finished
When I click my button I wish one of mc's disapear completely(first alpha changes from 1 to 0) then 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);
}
I dicided to use events but it doesnt 开发者_StackOverflow中文版work, can anyone help me?
Try moving the aBlend declaration outside of the buttonClickHandler as suggested by this post:
http://www.actionscript.org/forums/showpost.php3?s=e4e6512ae627e7810c4e991691324b9f&p=735466&postcount=4
i.e.
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);
}
精彩评论