I’m trying to load an image (image.jpg) into a movie (imageLoader). I want the image loader to be 150 pixels by 150 pixels, so that only a square of image.jpg is shown (basically a thumbnail). My code is currently warping the image (because the image is not 150 by 150), but I’m not sure what I did wrong…
Here is my code:
var imageLoader:Loader;
function loadImage(url:String):void {
imageLoader = new Loader();
imageLoader.load(new URLRequest(url));
imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageLoading);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
}
loadImage("image.jpg");
function imageLoaded(e:Event):void {
imageArea.addChild(imageLoader);
imageArea.width = 100;
imageArea.height = 100;
imageArea. x = 150;
imageArea. y = 150;
}
function imageLoading(e:ProgressEvent):void {
}
Any help would be appreciated. Thanks!