# Help with tween class

**URL:** <https://forum.kirupa.com/t/help-with-tween-class/312239>\
**Category:** flash\
**Created:** [July 28, 2010, 9:00pm UTC](https://forum.kirupa.com/t/help-with-tween-class/312239 "2010-07-28T21:00:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rserge](https://avatars.discourse-cdn.com/v4/letter/r/dc4da7/32.png) [@rserge](https://forum.kirupa.com/u/rserge)\
**Post date:** [July 28, 2010, 9:00pm UTC](https://forum.kirupa.com/t/help-with-tween-class/312239/1 "2010-07-28T21:00:46Z")

</div>

I am trying to use the tween class. This is totally new to me. I am reading tutorial on Kirupa.

```auto

import mx.transitions.Tween;
import mx.transitions.easing.*;
var xScaleT:Tween = new Tween(kText, "_rotation", Elastic.easeOut, 0, 360, 3, true);
var xPosT:Tween = new Tween(kText, "_x", Bounce.easeOut, 0, Stage.width, 3, true);
xScaleT.onMotionFinished = function() {
this.yoyo();
};
xPosT.onMotionFinished = function() {
this.continueTo(Stage.width / 2, 3);
};

```

All I need is a tween movement (Regular ease should be fine) of an instance.  
That instance is map\_mc. I need it to move to (For example 100,100…x,y)

I have a map with 102 buttons on it. When you click on a button it centers map\_mc with that button positioned in the middle. Currently this action “snaps” to the center when button is activated. I was hoping to use the tween class to animate that movement. If I can get help programming one button I think I can program the rest.  
To see sample  
[http://www.sergemedia.net/ds2/map/lissara.html](http://www.sergemedia.net/ds2/map/lissara.html)  
Click on a numbered lot to see it snap to middle.  
Here is AS of button 1 that tells it to go to x,y position. I need to replace taht portion with tween AS, I am assuming. See red code.

```auto

_root.map_mc.map_gra.lot1_btn.onRelease = function(){
    stopAllMCs();
     _root.map_mc.map_gra.lot1_btn.play();
	 _root.srchMC._visible=false;
	_root.info_mc._visible=true;
	_root.info_mc.gotoAndStop(1);
	[COLOR="Red"] if (this.pressed) {

_root.map_mc._x = 1250 - _root.map_mc.map_gra.lot1_btn._x;
_root.map_mc._y = 400 - _root.map_mc.map_gra.lot1_btn._y;

} else {

_root.map_mc._x = 1250 - _root.map_mc.map_gra.lot1_btn._x;
_root.map_mc._y = 400 - _root.map_mc.map_gra.lot1_btn._y;

}[/COLOR]
_root.map_mc._xscale=100;
_root.map_mc._yscale=100;
this.pressed = !this.pressed;
};

```

I appreciate the help.
