How to smooth an image loaded with FileReference?

Posted by Lost_in_code on Stack Overflow See other posts from Stack Overflow or by Lost_in_code
Published on 2010-03-12T00:16:51Z Indexed on 2010/03/12 1:37 UTC
Read the original article Hit count: 393

Been trying to smooth images loaded with FileReferece with no luck. Below is the code I'm using:

fileRef = new FileReference();
fileRef.addEventListener(Event.COMPLETE, fileLoaded);

private function fileLoaded(e:Event):void{
    var ldr:Loader = new Loader();             
    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e:Event):void{
        var bm:Bitmap = Bitmap(e.target.content as Bitmap);
        bm.smoothing = true;
        img.load(bm)
    }); 
    ldr.loadBytes(fileRef.data);
}   

<custom:SWFLoaderAdvanced id="img"/>

bm.smoothing should've smoothened the loaded image, but for some reason it doesn't. Am I missing something here?

Note: SWFLoaderAdvanced automatically smoothens any image that's loaded inside it. It works perfectly with loaded images other than the ones loaded with FileReference.

© Stack Overflow or respective owner

Related posts about flex

Related posts about actionscript-3