# AS2 Basic Tweening problem in my code

**URL:** https://forum.kirupa.com/t/as2-basic-tweening-problem-in-my-code/264255
**Category:** flash
**Created:** [June 24, 2008, 1:54pm UTC](https://forum.kirupa.com/t/as2-basic-tweening-problem-in-my-code/264255 "2008-06-24T13:54:21Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![c2k6](https://avatars.discourse-cdn.com/v4/letter/c/a9adbd/32.png) [@c2k6](https://forum.kirupa.com/u/c2k6)
#### Post date: [June 24, 2008, 1:54pm UTC](https://forum.kirupa.com/t/as2-basic-tweening-problem-in-my-code/264255/1 "2008-06-24T13:54:21Z")

</div>

hi i’m trying to use the tweening things in flash i have sucessfully made a movieclip tween in and now within that movieclip is a button that sends you further down the timeline  
what I’m trying to acheive now is to get the mc to tween back out then go to the specific frame so just using the flash 8 help files i’ve sort of worked out that I think i need to place this in the first frame of the moviclip that contains this button :

```auto
var tween_handler:Object = new Tween (_root.firstmenu, "_x", Bounce.easeOut, 176, -176, 25, false)
 
content2_btn.onRelease = function ():Void {
//I think something should go here but I'm not sure what... this is whats bugging me :-( 
 
}
tween_handler.onMotionFinished = function() { 
_root.gotoAndStop(5);
}
}

```

Any help would greatly be appreciated!

var tween\_handler:Object = new Tween(\_root.firstmenu, “\_x”, Bounce.easeOut, 176, -176, 25, false)content2\_btn.onRelease = function ():Void {//I think something should go here but I’m not sure what… this is whats bugging me ☹ tween\_handler.onMotionFinished = function() { \_root.gotoAndStop(5);}}thanks for any help u could give!

---

<div class="post-metadata">

### Author: ![frazzle](https://avatars.discourse-cdn.com/v4/letter/f/2bfe46/32.png) [@frazzle](https://forum.kirupa.com/u/frazzle)
#### Post date: [July 2, 2008, 1:21pm UTC](https://forum.kirupa.com/t/as2-basic-tweening-problem-in-my-code/264255/2 "2008-07-02T13:21:09Z")

</div>

You are nearly there, but not quite!

If you are looking to have a button click tween your clip back to its original position, then have the timeline jump you will have to create a new tween. See beloow…

```auto
// your original tween...
var tween_handler:Object = new Tween (_root.firstmenu, "_x", Bounce.easeOut, 176, -176, 25, false)
 
content2_btn.onRelease = function ():Void {
	// first tween the item back...
	var tweenBack_handler:Object = new Tween (_root.firstmenu, "_x", Bounce.easeOut, -176, 176, 25, false);
	
	// now you have the right tween for your onMotionFinished call...
	tweenBack_handler.onMotionFinished = function() { 
		_root.gotoAndStop(5);
	}
}

```

---

<div class="post-metadata">

### Author: ![c2k6](https://avatars.discourse-cdn.com/v4/letter/c/a9adbd/32.png) [@c2k6](https://forum.kirupa.com/u/c2k6)
#### Post date: [July 2, 2008, 1:40pm UTC](https://forum.kirupa.com/t/as2-basic-tweening-problem-in-my-code/264255/3 "2008-07-02T13:40:04Z")

</div>

thanks Frazzale thats great!
