I’ve been asked this by at least 4 customers and provided them with simple samples that set the stage.quality = StageQuality.BEST. This provides smoother image scaling, but at potentially some performance cost. You also have to use the loaded image’s content property, casting it to a bitmap in order to scale it. I don’t recall exactly where I found the info on this, but I Googled and didn’t find a good reference for doing this, so I thought I’d post my own solution.

Check out the code snippet:

<mx:application xmlns:mx="http://www.adobe.com/2006/mxml">
    applicationComplete="stage.quality = StageQuality.BEST">

    <mx:script>
        <!–[CDATA[
            private function handleImageComplete(event: Event): void {
                var bitmap: Bitmap = ((event.target as Image).content as Bitmap);
                if (bitmap != null) {
                    bitmap.smoothing = true;
                }
            }
        ]]–>
    </mx:script>

    <mx:hslider id="zoomSlider">
        height="150"
        buttonMode="true" useHandCursor="true"
        minimum="1" maximum="10"
        snapInterval="1" tickInterval="1" value="1"/>

    <mx:image height="600" width="800">
        scaleX="{zoomSlider.value}" scaleY="{zoomSlider.value}"
        source="me.jpg" complete="handleImageComplete(event)" />
</mx:image></mx:hslider></mx:application>



3 Comments »