Manipulating images loaded using URLRequest

Hi guys,

So using AS3 I’ve got external images to load perfectly, the code is pretty much:


pageContent.addChild(loadImage("assets/projects/fiji_hilton/hero_nuku_4.jpg"));
...
public function loadImage(url:String):Loader{
            var image:URLRequest = new URLRequest(url);
            var loader:Loader = new Loader(); 
            
            loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);  
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);  
            
            loader.load(image);
            return loader;
        }

This is working great, BUT i cant seem to get access to the image once its loaded. What i mean is, how can i change its dimensions, or how can i just its smoothing, any of of its properties really.

I’ve tried acessing it through the loader variable, but havent had any luck. It cant be that hard to do, seems like it would be such a common thing.

Thanks!

Alright turns out i figured it out :stuck_out_tongue:

Once the image is loaded so:


loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete); 
...
public function loadComplete(event:Event):void {
            trace("Complete");
            var actualImage = loader.content;
            loader.content.width = 100;
        }

You can get the actual bitmap object from the ‘loader.content’ :party: