4 Replies Latest reply on Mar 26, 2010 9:47 AM by daslicht

    How to scale pictures in a proper way?

    daslicht Level 2

      Hello,

      mir ist aufgefallen das wenn man Bilder in Flex skaliert, diese an  Qualitaet verlieren.
      I have notices that when you scale Images via AS the quality gets ugly.

       

      http://www.ansolas.de/dev/releases/ScalePic/Scale.html

       

       

      Is  there a way to keep it beautiful?

       

      I tried:

      maintainAspectRatio="true" 
      smoothBitmapContent="true"


      I also found this approach but that isnt working either?

      package {
      
                import mx.controls.Image;
                import flash.display.Loader;
                  import flash.display.Bitmap;     
             import flash.events.Event;
             import mx.core.mx_internal;
             use namespace mx_internal;
                /**
                 * SmoothImage
                 * Automatically turns smoothing on after image has loaded
                 * @author Ben Longoria
                 */
                public class SmoothImage extends Image 
                   {
                public function SmoothImage():void 
                      {
                     super();
                }
       
                /**
                 * @private
                 */
                override mx_internal function 
                         contentLoaderInfo_completeEventHandler(event:Event  ):void 
      
                      {
                     var smoothLoader:Loader = event.target.loader as Loader;
                     var smoothImage:Bitmap = smoothLoader.content as Bitmap;
                     smoothImage.smoothing = true;
                     super.contentLoaderInfo_completeEventHandler(event  );
                }
      
           }
      
      }