I have a MovieClip that I want to have the arrow keys call the below functions. When press the right arrow key, I want it to call tweenIntoView() and when press the Left arrow key, I want it to call TweenOutOfView() and I currently have it working fine. The problem is that when I run that tweenOutOfView() function, the MovieClip go's outside of view of the screen and repeatedly calling the method doesn't return it back to where it started. How do I do it properly? The tweenIntoView() function works as I expect because it starts off the screen and zooms into the middle of the screen.
//holds the tween to tween in
var tweenInFromLeftSide:TweenMax;
//holds the tween to tween out
var tweenOutFromLeftSide:TweenMax;
public function tweenIntoView() {
tweenInFromLeftSide = TweenMax.from(this, 1, {x:-760, alpha:0, ease:Strong.easeOut});
}
public function tweenOutOfView() {
tweenOutFromLeftSide = TweenMax.to(this, 1, { x:780, alpha:0, ease:Strong.easeOut } );
}