Smoothing resized distorted images in Flex

For some strange reason, the images that are resized in flex appear pixelated (lose their sharpness) and look like low resolution pictures. Turns out there is a very simple solution to this, as highlighted by Ronald – we just need to create a smoothing function and apply it to the image.

Sake of convenience, repeating his solution here –

<!--?xml version="1.0" encoding="utf-8"?-->

<![CDATA[ //call this function from where ever you need Image Smoothing

smoothImage(evt:Event):void{
       var myBitmap:Bitmap = ((evt.target as Image).content as Bitmap);
       if (myBitmap != null) { myBitmap.smoothing = true;}
   }

]]>

<!--Usage: call complete="smoothImage(event) from image component ) -->

Why this happens in the first place, I don’t know, but this sure is a good solution.

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax