Hi all, i cant figure how to scale the image which is inside the movieclip…
I got a button when clicked create a dynamic movieclip then loads the image inside, unfortunately if the image is bigger then movieclip, then movieclip automatically resizes itself. What i m trying to achieve is, if the movieclip is 200x300px n the image is bigger then that. Image shld resize itself n stay center aligned to the movieclip… is that possible???
my code:
on (click) {
import flash.net.FileReference;
import flash.display.BitmapData;
var listener:Object = new Object();
listener.onSelect = function(file:FileReference):Void {
//trace("name: " + file.name);
var mcPict:MovieClip = createEmptyMovieClip( 'mcPict', 9000 );
//mcPict._x = 20;
//mcPict._y = 20;
mcPict._xscale = 20;
mcPict._yscale = 20;
mcPict.loadMovie( file.name );
// set image
var curImg:BitmapData = new BitmapData();
curImg.draw( mcPict );
}
// File Browser
var allTypes:Array = new Array();
var imageTypes:Object = new Object();
imageTypes.description = "Images (*.JPG;*.JPEG;*.JPE;*.GIF;*.PNG;)";
imageTypes.extension = "*.jpg; *.jpeg; *.jpe; *.gif; *.png;";
allTypes.push(imageTypes);
var fileRef:FileReference = new FileReference();
fileRef.addListener(listener);
fileRef.browse(allTypes);
}
thnx for your help!