Thanks to Scotty I know how to do a height check with setInterval, but how do you make one to check the _x and _y? I would like to use the following code to scale a mc with “onRollOver” and then the mc would scale back onRollOut.
onClipEvent (load) {
targetX = 200;
targetY = 200;
vx = 0;
// our current velocity
// play with these next to values to get desired amount of springyness
springSpeed = .2;
// higher values make spring move faster
springDamp = .8;
// lower values make more resistance (friction)
this.onEnterFrame = function() {
var diffX = targetX-this._xscale;
var diffY = targetY-this._yscale;
vx += diffX*springSpeed;
vx += diffY*springSpeed;
vx *= springDamp;
this._xscale += vx;
this._yscale += vx;
if (Math.abs(diffX)<1 && Math.abs(diffY)<1 && Math.abs(vx)<.1) {
this._xscale = targetX;
this._yscale = targetY;
vx = 0;
delete this.onEnterFrame;
}
};
}
Thanks