开发者

How to know when the yoyo will finish?

开发者 https://www.devze.com 2023-02-08 13:56 出处:网络
I want show a trace(\"test\") at the end of the yoyo How to know when the yoyo will finish? I\'m using AS3

I want show a trace("test") at the end of the yoyo

How to know when the yoyo will finish?

I'm using AS3

import fl.transitions.Tween;
import fl.transitions.ea开发者_运维百科sing.*;
import fl.transitions.TweenEvent;

var myTween = new Tween(my_mc, "x", Strong.easeInOut, 100,300, 1, true);

myTween.addEventListener(TweenEvent.MOTION_FINISH, onFinish);

function onFinish(e:TweenEvent):void {
    myTween.yoyo();
}


import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;

var myTween = new Tween(my_mc, "x", Strong.easeInOut, 100,300, 1, true);
myTween.addEventListener(TweenEvent.MOTION_FINISH, onFinish);
var yoyoCounter:uint;

function onFinish(e:TweenEvent):void {
    if(yoyoCounter < 1)
    {
        myTween.yoyo();
        ++yoyoCounter;
    }
    else
    {
        myTween.removeEventListener(TweenEvent.MOTION_FINISH, onFinish);
        trace("test");
    }
}

Rob

0

精彩评论

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