0

What I have are two MovieClips that I wish to move around the screen (one horizontally and the other vertically) my ideal scenario would be an android type animation like this...

TranslateAnimation moveDown;

if (isMainGuiVisible)
{
    moveDown = new TranslateAnimation(0, 0, 0, 150);
}
else
{
    moveDown = new TranslateAnimation(0, 0, 150, 0);
}

moveDown.setDuration(time);
moveDown.setFillAfter(true);

frmMainGUI_mc.startAnimation(moveDown);

Where it's doing this...

moveDown = new TranslateAnimation (fromXDelta, toXDelta, fromYDelta, toYDelta)

Edit: I basically need a way to animate a MovieClip moving off and on screen in the direction I tell it to. If that is like above where I'm telling it to move back and forth by 150 pixels that moves it off and on screen or some other way...

Mytheral
  • 3,929
  • 7
  • 34
  • 57
  • I believe you need this: [Tween class](http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/transitions/Tween.html) or any of the tweening libraries. – Vesper Nov 27 '12 at 14:49

1 Answers1

2

Use a tweening library. Greensock's TweenLite is a popular one but there are others (I use GTween generally).

Basic example from the TweenLite page:

TweenLite.to(mc, 1, {x:65, y:117});

Where mc is the display object to tween, 1 is the duration of the tween and x and y are the new x and y positions.

Pixel Elephant
  • 20,649
  • 9
  • 66
  • 83