I am trying to use the tween class. This is totally new to me. I am reading tutorial on Kirupa.
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
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.
_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.