AS3.0等待补间完成

发布于 2024-12-05 21:17:39 字数 526 浏览 0 评论 0原文

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

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);
}

我决定使用事件,但它不起作用,有人可以帮助我吗?

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 work, can anyone help me?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

才能让你更想念 2024-12-12 21:17:39

尝试按照这篇文章的建议将 aBlend 声明移到 ButtonClickHandler 之外:

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);
}

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);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文