Richard Parnaby-King
Richard Parnaby-King

Reputation: 14892

How to prevent image from distorting when Flash is Zoomed

I am loading a jpg into my Flash. When I zoom into the flash in the browser (for example, setting the zoom to 125%) the jpg in the flash starts to distort and pixelate. How do I get Flash to not pixelate the jpg?

Upvotes: 0

Views: 303

Answers (1)

crooksy88
crooksy88

Reputation: 3851

You need to set the smoothing on your loaded jpg to true.

Something like:

_urlRequest=new URLRequest("urltoimage");
_loader=new Loader;
_loader.load(_urlRequest);
_loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace("ERROR: "+e) });
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, ImageLoaded, false, 0, true);



function ImageLoaded(e:Event):void {

    _loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, ImageLoaded); 

    Bitmap(_loader.content).smoothing = true;

    addChild(_loader);

}

Upvotes: 3

Related Questions