1 Reply Latest reply on Apr 16, 2009 5:12 AM by Inderjit

    Smoothing external images

    Carlos Eduardo Garza
      how to load images before creating the image class for enable smoothing?
      In this examples the image is embeded. but i need to load the image from {data.image}

      examples:

      The first approach uses the BitmapAsset class, where init() is called on creationComplete as follows:

      import mx.core.BitmapAsset;

      [Bindable]
      public var mySmoothImage:BitmapAsset;

      [Bindable]
      [Embed(source="assets/image.jpg")]
      public var myImage:Class;

      public function init():void
      {
      smoothImage = BitmapAsset(new myImage());
      smoothImage.smoothing = true;
      }

      The second approach is somewhat more compact, and uses a class level embed that extends Bitmap, as follows:


      [Embed(source="Image.jpg")]
      public class smoothImage extends Bitmap
      {
      public function smoothImage()
      {
      smoothing = true;
      }
      }