views:

45

answers:

2

Using Tween class maybe? I tried the easeOut. But if will write 2 Tween, the 2nd one will overwrite the 1st one, so I only see the obj moving in the 2nd Tween direction, not the 1st Tween direction.

I know the coordinates for the 2nd Tween below is not correct (cos all coordinates shld follow the defined reference point), so I need to find out the logo's width and height. But is alright now cos it is for testing purpose.

import fl.transitions.Tween;
import fl.transitions.easing.*;
logo.visible = false;
addChild(logo);

circle.addEventListener(MouseEvent.CLICK, moveObj);

function moveObj(e:MouseEvent):void{
    logo.visible = true;
    var tweenRight:Tween = new Tween(logo,"x",None.easeOut, 100, 300, 2, true);
    var tweenLeft:Tween = new Tween(logo,"x",None.easeOut, 300, 100, 2, true);

}
A: 

You have both these happening at the same time, you'll need to delay the second one till after the first ends.

Tyler Egeto
Check out my other related qn here: http://stackoverflow.com/questions/2161123/move-objects-in-an-array-producing-a-stadium-wave-effect
yeeen
A: 

You are firing the two tweens at the same time so you can for example listen to motion finish event and launch the other tween at this moment:

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

logo.visible = false;
addChild(logo);

circle.addEventListener(MouseEvent.CLICK, moveObj);

function moveObj(e:MouseEvent):void{
    logo.visible = true;
    var tweenRight:Tween = new Tween(logo,"x",None.easeOut, 100, 300, 2, true);
    tweenRight.addEventListener(TweenEvent.MOTION_FINISH, onTweenRightFinished);
}
function onTweenRightFinished(e:TweenEvent):void {
    e.currentTarget.removeEventListener(TweenEvent.MOTION_FINISH, onTweenRightFinished);
    var tweenLeft:Tween = new Tween(logo,"x",None.easeOut, 300, 100, 2, true);
}
Patrick
I know why the error alr, it is cos it shld be "import fl.transitions.TweenEvent;" not "import fl.transitions.TweenEvent.*; ". Thx.
yeeen
Check out my other related qn here: http://stackoverflow.com/questions/2161123/move-objects-in-an-array-producing-a-stadium-wave-effect
yeeen