tags:

views:

3498

answers:

3

I have an image viewer I wrote in Flex that scales the size of the image you're currently viewing based on the size of the browser. This is what the tag looks like:

<mx:Image id="img"
    maintainAspectRatio="true"
    source="{horizontalList.selectedItem.image}-large.jpg"
    height="100%"
    horizontalCenter="0"
    horizontalAlign="center"
    top="5" 
    width="{horizontalList.width}"
    updateComplete="onImageChange()"
    click="onImgClick()"
    />

The original image size is always larger than the area of the browser, and unfortunately, Flex doesn't appear to be doing a very good job of downscaling the image. In fact, HTML in IE does a much better job if I use it's image tag. Is there a "quality" setting for scaling in Flex that I'm missing?

Thanks.

A: 

This is a spot of bother with Flex 3 -- using an image in a list control. You have to be very careful to get the scaling right.

Why not try playing around with different combinations of scaleContent and maintainAspectRatio properties of Image controls?

Here's a tutorial on scaling Images.

dirkgently
Thanks for the response. My image control isn't inside a list control. It's just using a separate list control as a reference to size itself. I read the tutorial you linked, but it didn't really talk about image quality. My basic question is: How do you control quality when downscaling an image? By default, Flex seems to have a lot of aliasing problems when shrinking the image.Thanks.
+6  A: 

See this: Smoothing resized distorted images in flex

tst
That fixed it. Thanks for the answer!
A: 

try to set the width and height of the control to the dimensions of the image and set the scaleContent property to true

Rick J