Code:import mx.transitions.Tween; import mx.transitions.easing.*; stop(); // set stage scaling Stage.scaleMode = "noScale"; Stage.align = "TL"; // tween variables var tweenX1, tweenX2; var tweenY1, tweenY1; mcBotLeft.pinX = mcBotLeft._x; mcBotLeft.pinY = Stage.height - mcBotLeft._y; mcBotRight.pinX = Stage.width - mcBotRight._x; mcBotRight.pinY = Stage.height - mcBotRight._y; // resize event Stage.addListener(this); function onResize() { // stop any tweens if playing tweenX1.stop(); tweenY1.stop(); tweenX2.stop(); tweenY2.stop(); tweenX1 = new Tween(mcBotLeft, "_x", Bounce.easeOut, mcBotLeft._x, mcBotLeft.pinX + 30, 0.5, true); tweenY1 = new Tween(mcBotLeft, "_y", Bounce.easeOut, mcBotLeft._y, Stage.height - mcBotLeft.pinY - 30, 0.5, true); tweenX1.onMotionFinished = function() { tweenX1.continueTo(mcBotLeft.pinX, 0.5); }; tweenY1.onMotionFinished = function() { tweenY1.continueTo(Stage.height - mcBotLeft.pinY, 0.5); }; tweenX2 = new Tween(mcBotRight, "_x", Bounce.easeOut, mcBotRight._x, Stage.width - mcBotRight.pinX - 30, 0.5, true); tweenY2 = new Tween(mcBotRight, "_y", Bounce.easeOut, mcBotRight._y, Stage.height - mcBotRight.pinY - 30, 0.5, true); tweenX2.onMotionFinished = function() { tweenX2.continueTo(Stage.width - mcBotRight.pinX, 0.5); }; tweenY2.onMotionFinished = function() { tweenY2.continueTo(Stage.height - mcBotRight.pinY, 0.5); }; } // immediately fit to current size onResize();




Reply With Quote