class linksv.SimpleTween /** Class used for Zoom, Pan and Reset map @properties: 1. time - tween time in milliseconds @public methods: 1. animate( mc :MovieClip, prop, //:String or Array value0, //:Number or Array value1, // :Number or Array callScope :Object, callFunction :Function, pb :Object, refPoint:Object) :Void tweens mc properties like _x, _y, _xscale, _yscale, _rotation, _alpha (single or group) prop: "_x", "_xscale", ["_x", "_y"] OR "scale" - scaling relative to reference point @private methods: 1.1 applyValue(mc, prop, value0, value1, t) 1.2 fZoomStage(mc, scale, x, y) 2. getValue(value0, value1, t) @Samples of use: var c = this; buttons_mc.pb0.onRelease = function () { animate(stage_mc, "scale", stage_mc._xscale, stage_mc._xscale * 1.5, c, onAnimationEnd,this, {x: width/2, y: height/2})}; buttons_mc.pb1.onRelease = function () { animate(stage_mc, "scale", stage_mc._xscale, stage_mc._xscale * 0.66666666667, c, onAnimationEnd,this, {x: width/2, y: height/2})}; buttons_mc.pb2.onRelease = function () { //reset animate(stage_mc, ["_xscale","_yscale","_x","_y"], [stage_mc._xscale, stage_mc._yscale, stage_mc._x, stage_mc._y], [100,100,x0,y0], c, onAnimationEnd",this); }; buttons_mc.pb3.onRelease = function () { animate(stage_mc, "_x", stage_mc._x, stage_mc._x -150)}; buttons_mc.pb4.onRelease = function () { animate(stage_mc, "_x", stage_mc._x, stage_mc._x +150)}; buttons_mc.pb5.onRelease = function () { animate(stage_mc, "_y", stage_mc._y, stage_mc._y -150)}; buttons_mc.pb6.onRelease = function () { animate(stage_mc, "_y", stage_mc._y, stage_mc._y +150)}; **/ { private static var className = "linksv.SimpleTween"; private var time = 300; //in ms function SimpleTween() { } public function animate( mc:MovieClip, prop, value0, value1, callScope:Object, callFunction :Function, pb :Object, refPoint:Object) :Void /* prop :String or Array of String - mc property ("_x","_xscale","_alpha","_rotation" exeption: "scale", uses ref point to scale relative to value0, value1 :Number or Array of Numbers - satrt, value1 */ { //var time = 300; var startTime = getTimer(); var t=0, dt=25, t_eased; var c=this; var intervalId = setInterval( function () { t = (getTimer()-startTime)/c.time; t_eased = mx.transitions.easing.Regular.easeIn(t,0,1,1); if (prop=="scale") { c.fZoomStage(mc, c.getValue(value0, value1, t), refPoint.x, refPoint.y); } else { c.applyValue(mc, prop, value0, value1, t_eased) } if (t_eased>=1) { clearInterval(intervalId); if (callScope!=undefined && callFunction!=undefined) { //c[callBack](); callFunction.apply(callScope, [pb, "onAnimationEnd"]); } } }, dt) } private function applyValue(mc, prop, value0, value1, t) // t: [0,1] { if (prop instanceof Array) { var imax=prop.length; for (var i=0; i