PDA

View Full Version : loaded images resize in flash not when uploaded


tarafenton
05-06-2008, 08:45 PM
HI

I'm loading images from an XML file and some are large, so when they are loaded I resize them, which works great from flash. But for some reason when I uploaded it the image loads at full size :confused:

Can anyone suggest why?


var imageLoader:Loader = new Loader();

function loadImage():void {
imageLoader = new Loader();
imageLoader.contentLoaderInfo.addEventListener(Eve nt.COMPLETE, onImageLoaded);
imageLoader.load(new URLRequest(masterList [currentImage] [0] ) );
addChild(imageLoader);
}

function onImageLoaded(evt:Event) {

evt.target.content.height=masterList [currentImage] [4];
evt.target.content.width=masterList [currentImage] [5];
evt.target.content.y = ((stage.height - 30) - masterList [currentImage] [4])/2;
evt.target.content.x = (stage.width - masterList [currentImage] [5])/2;
evt.target.content.smoothing = true;

currentImage++;
loadImage();

}

pcmxa
05-06-2008, 10:58 PM
You might consider using a UILoader rather than a Loader, since this has a scale content property which if set to true will scale the content to the size of the loader