How to smooth an image loaded with FileReference?
- by Lost_in_code
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.