/************************************************************************************** Program: ScaleTween Version: 0.5 Author : Petit Publications http://petitpub.com Usage : This Actionscript 2.0 should be included in the first frame of the *.fla file to run the show. Purpose: To test the Tween class in tweening the scale of a JPG image. **************************************************************************************/ // Import the Tween class and the easing package import mx.transitions.Tween; import mx.transitions.easing.*; // Global variables var mc:MovieClip; // The movieclip used as a holder for the image var scaleTo = 40; // We will scale the image to 40% // create a movieclip to load the photo into function getImage(){ mc = _root.createEmptyMovieClip("photo", i); // position the clip mc._x = 1; mc._y = 1; // create a movieclip so that our onPress isn't overwritten by the jpg mc.createEmptyMovieClip("jpgHolder", 1); // and load the jpeg into it mc.jpgHolder.loadMovie("images/petit.jpg"); // add the onPress handler to the movieclip mc.onPress = doTween; } // Do the scaling tween on the MovieClip function doTween(){ // trace(mc._alpha); // check for access // mc._alpha = 20; // works nicely var mcXScale:Tween = new Tween(mc, "_xscale", Regular.easeIn, 100, scaleTo, 3, true); var mcYScale:Tween = new Tween(mc, "_yscale", Regular.easeIn, 100, scaleTo, 3, true); }; function main(){ getImage(); }