Transferred from the Adobe Open Source Subversion Repository

Revision: 22054
Author:   jasonsj@adobe.com
Date:     2011-08-17T18:31:43.331814Z

Log Message:
-----------
Adding new BitmapScaleMode.ZOOM scaling option for BitmapImage primitive and Image component. scaleMode="zoom" will fit the bitmap by scaling the smaller dimension ratio up or down such that one dimension fits the component dimension while the other is cropped based on horizontalAlign and verticalAlign values.

QE notes:
Doc notes:
Bugs: SDK-30046
Reviewer: jszeto
Tests run: checkintests, mustella BitmapImage and Image
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/Image.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/framework/src/mx/graphics/BitmapScaleMode.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/primitives/BitmapImage.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1285637 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/primitives/BitmapImage.as
+++ frameworks/projects/spark/src/spark/primitives/BitmapImage.as
@@ -41,8 +41,8 @@
 import mx.graphics.BitmapFillMode;
 import mx.graphics.BitmapScaleMode;
 import mx.graphics.BitmapSmoothingQuality;
+import mx.utils.DensityUtil;
 import mx.utils.LoaderUtil;
-import mx.utils.DensityUtil;

 import spark.core.ContentRequest;
 import spark.core.DisplayObjectSharingMode;
@@ -62,14 +62,14 @@
  *  Dispatched when content loading is complete. This
  *  event is only dispatched for url and ByteArray based
  *  sources (those sources requiring a Loader).
- *
+ *
  *
Note that for content loaded via Loader, both
  *  ready and complete events
  *  are dispatched.
  For other source types such as
  *  embeds, only ready is dispatched.
  *
  *  @eventType flash.events.Event.COMPLETE
- *
+ *
  *  @langversion 3.0
  *  @playerversion Flash 10
  *  @playerversion AIR 2.0
@@ -78,11 +78,11 @@
 [Event(name="complete", type="flash.events.Event")]

 /**
- *  Dispatched when a network request is made over HTTP
+ *  Dispatched when a network request is made over HTTP
  *  and Flash Player or AIR can detect the HTTP status code.
- *
+ *
  *  @eventType flash.events.HTTPStatusEvent.HTTP_STATUS
- *
+ *
  *  @langversion 3.0
  *  @playerversion Flash 10
  *  @playerversion AIR 2.0
@@ -95,7 +95,7 @@
  *  @see flash.events.IOErrorEvent
  *
  *  @eventType flash.events.IOErrorEvent.IO_ERROR
- *
+ *
  *  @langversion 3.0
  *  @playerversion Flash 10
  *  @playerversion AIR 2.0
@@ -106,14 +106,14 @@
 /**
  *  Dispatched when content is loading.
  *
- *
Note:
+ *
Note:
  *  The progress event is not guaranteed to be dispatched.
  *  The complete event may be received, without any
  *  progress events being dispatched.
  *  This can happen when the loaded content is a local file.

  *
  *  @eventType flash.events.ProgressEvent.PROGRESS
- *
+ *
  *  @langversion 3.0
  *  @playerversion Flash 10
  *  @playerversion AIR 2.0
@@ -123,16 +123,16 @@

 /**
  *  Dispatched when content loading is complete.  Unlike the
- *  complete event, this event is dispatched for
- *  all source types.
- *
+ *  complete event, this event is dispatched for
+ *  all source types.
+ *
  *
Note that for content loaded via Loader, both
  *  ready and complete events
  *  are dispatched.
  For other source types such as
  *  embeds, only ready is dispatched.
  *
  *  @eventType mx.events.FlexEvent.READY
- *
+ *
  *  @langversion 3.0
  *  @playerversion Flash 10
  *  @playerversion AIR 2.0
@@ -145,7 +145,7 @@
  *  @see flash.events.SecurityErrorEvent
  *
  *  @eventType flash.events.SecurityErrorEvent.SECURITY_ERROR
- *
+ *
  *  @langversion 3.0
  *  @playerversion Flash 10
  *  @playerversion AIR 2.0
@@ -154,12 +154,12 @@
 [Event(name="securityError", type="flash.events.SecurityErrorEvent")]

 /**
- *  A BitmapImage element defines a rectangular region in its parent element's
+ *  A BitmapImage element defines a rectangular region in its parent element's
  *  coordinate space, filled with bitmap data drawn from a source file or
  *  source URL.
- *
+ *
  *  @includeExample examples/BitmapImageExample.mxml
- *
+ *
  *  @langversion 3.0
  *  @playerversion Flash 10
  *  @playerversion AIR 2.0
@@ -168,16 +168,16 @@
 public class BitmapImage extends GraphicElement
 {
     include "../core/Version.as";
-
+
     //--------------------------------------------------------------------------
     //
     //  Constructor
     //
     //--------------------------------------------------------------------------
-
-    /**
-     *  Constructor.
-     *
+
+    /**
+     *  Constructor.
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
@@ -186,23 +186,23 @@
     public function BitmapImage()
     {
         super();
-
+
         // Typically, this should not be mirrored.
         layoutDirection = "ltr";
     }
-
+
     //--------------------------------------------------------------------------
     //
     //  Properties
     //
     //--------------------------------------------------------------------------
-
+
     private var _scaleGridBottom:Number;
     private var _scaleGridLeft:Number;
     private var _scaleGridRight:Number;
     private var _scaleGridTop:Number;
     private var bitmapDataCreated:Boolean;
-    private static var matrix:Matrix = new Matrix();
+    private static var matrix:Matrix = new Matrix();
     private var cachedSourceGrid:Array;
     private var cachedDestGrid:Array;
     private var imageWidth:Number = NaN;
@@ -213,96 +213,96 @@
     private var previousUnscaledHeight:Number;
     private var sourceInvalid:Boolean;
     private var loadFailed:Boolean;
-
+
     //----------------------------------
     //  bitmapData
     //----------------------------------
-
+
     private var _bitmapData:BitmapData;
-
-    /**
-     *  Returns a copy of the BitmapData object representing
+
+    /**
+     *  Returns a copy of the BitmapData object representing
      *  the currently loaded image content (unscaled).  This property
      *  is null for untrusted cross domain content.
-     *
+     *
      *  @default null
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 2.0
      *  @productversion Flex 4.5
      */
-    public function get bitmapData():BitmapData
-    {
-        return _bitmapData ? _bitmapData.clone() : _bitmapData;
-    }
-
+    public function get bitmapData():BitmapData
+    {
+        return _bitmapData ? _bitmapData.clone() : _bitmapData;
+    }
+
     //----------------------------------
     //  bytesLoaded
     //----------------------------------
-
+
     private var _bytesLoaded:Number = NaN;
-
+
     /**
      *  The number of bytes of the image already loaded.
-     *  Only relevant for images loaded by request URL.
-     *
+     *  Only relevant for images loaded by request URL.
+     *
      *  @default NaN
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 2.0
      *  @productversion Flex 4.5
      */
-    public function get bytesLoaded():Number
-    {
-        return _bytesLoaded;
-    }
-
+    public function get bytesLoaded():Number
+    {
+        return _bytesLoaded;
+    }
+
     //----------------------------------
     //  bytesTotal
     //----------------------------------
-
+
     private var _bytesTotal:Number = NaN;
-
-    /**
-     *  The total image data in bytes loaded or pending load.
-     *  Only relevant for images loaded by request URL.
-     *
+
+    /**
+     *  The total image data in bytes loaded or pending load.
+     *  Only relevant for images loaded by request URL.
+     *
      *  @default NaN
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 2.0
      *  @productversion Flex 4.5
      */
-    public function get bytesTotal():Number
-    {
-        return _bytesTotal;
-    }
-
+    public function get bytesTotal():Number
+    {
+        return _bytesTotal;
+    }
+
     //----------------------------------
     //  clearOnLoad
     //----------------------------------
-
+
     private var _clearOnLoad:Boolean = true;
-
-    /**
-     *  Denotes whether or not to clear previous
+
+    /**
+     *  Denotes whether or not to clear previous
      *  image content prior to loading new content.
-     *
+     *
      *  @default true
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 2.0
      *  @productversion Flex 4.5
      */
-    public function get clearOnLoad():Boolean
-    {
-        return _clearOnLoad;
-    }
-
+    public function get clearOnLoad():Boolean
+    {
+        return _clearOnLoad;
+    }
+
     /**
      *  @private
      */
@@ -310,29 +310,29 @@
     {
         _clearOnLoad = value;
     }
-
+
     //----------------------------------
     //  contentLoaderGrouping
     //----------------------------------
-
+
     private var _contentLoaderGrouping:String;
-
+
     /**
      *  Optional content grouping identifier to pass to the an
-     *  associated IContentLoader instance's load() method.
+     *  associated IContentLoader instance's load() method.
      *  This property is only considered when a valid contentLoader
      *  is assigned.
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
      *  @productversion Flex 4.5
      */
-    public function get contentLoaderGrouping():String
-    {
-        return _contentLoaderGrouping;
-    }
-
+    public function get contentLoaderGrouping():String
+    {
+        return _contentLoaderGrouping;
+    }
+
     /**
      *  @private
      */
@@ -344,30 +344,30 @@
             invalidateProperties();
         }
     }
-
+
     //----------------------------------
     //  contentLoader
     //----------------------------------
-
+
     private var _contentLoader:IContentLoader;
     private var contentLoaderInvalid:Boolean;
-
+
     /**
      *  Optional custom image loader (e.g. image cache or queue) to
      *  associate with content loader client.
-     *
+     *
      *  @default null
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
      *  @productversion Flex 4.5
      */
-    public function get contentLoader():IContentLoader
-    {
-        return _contentLoader;
-    }
-
+    public function get contentLoader():IContentLoader
+    {
+        return _contentLoader;
+    }
+
     /**
      *  @private
      */
@@ -380,44 +380,44 @@
             invalidateProperties();
         }
     }
-
+
     //----------------------------------
     //  fillMode
     //----------------------------------
-
+
     /**
      *  @private
      */
     protected var _fillMode:String = BitmapFillMode.SCALE;
-
+
     [Inspectable(category="General", enumeration="clip,repeat,scale", defaultValue="scale")]
-
+
     /**
      *  Determines how the bitmap fills in the dimensions. If you set the value
-     *  of this property in a tag, use the string (such as "repeat"). If you set the value of
+     *  of this property in a tag, use the string (such as "repeat"). If you set the value of
      *  this property in ActionScript, use the constant (such as BitmapFillMode.CLIP).
-     *
+     *
      *
When set to BitmapFillMode.CLIP ("clip"), the bitmap
      *  ends at the edge of the region.

-     *
-     *
When set to BitmapFillMode.REPEAT ("repeat"), the bitmap
+     *
+     *
When set to BitmapFillMode.REPEAT ("repeat"), the bitmap
      *  repeats to fill the region.

      *
      *
When set to BitmapFillMode.SCALE ("scale"), the bitmap
      *  stretches to fill the region.

-     *
+     *
      *  @default BitmapFillMode.SCALE
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
-    public function get fillMode():String
-    {
-        return _fillMode;
-    }
-
+    public function get fillMode():String
+    {
+        return _fillMode;
+    }
+
     /**
      *  @private
      */
@@ -429,32 +429,32 @@
             invalidateDisplayList();
         }
     }
-
+
     //----------------------------------
     //  horizontalAlign
     //----------------------------------
-
+
     /**
      *  @private
      */
     private var _horizontalAlign:String = HorizontalAlign.CENTER;
-
+
     [Inspectable(category="General", enumeration="left,right,center", defaultValue="center")]
-
-    /**
+
+    /**
      *  The horizontal alignment of the content when it does not have
-     *  a one-to-one aspect ratio and scaleMode is set to
+     *  a one-to-one aspect ratio and scaleMode is set to
      *  BitmapScaleMode.LETTERBOX.
-     *
+     *
      *
Can be one of HorizontalAlign.LEFT ("left"),
-     *  HorizontalAlign.RIGHT ("right"), or
+     *  HorizontalAlign.RIGHT ("right"), or
      *  HorizontalAlign.CENTER ("center").

-     *
+     *
      *
This property is only applicable when fillMode is set to
      *  to BitmapFillMode.SCALE ("scale").

-     *
+     *
      *  @default HorizontalAlign.CENTER
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
@@ -464,19 +464,19 @@
     {
         return _horizontalAlign;
     }
-
+
     /**
      *  @private
      */
     public function set horizontalAlign(value:String):void
     {
-        if (value == _horizontalAlign)
+        if (value == _horizontalAlign)
             return;
-
+
         _horizontalAlign = value;
         invalidateDisplayList();
     }
-
+
     /**
      *  @private
      */
@@ -489,34 +489,34 @@
         else
             return 0.5;
     }
-
+
     //----------------------------------
     //  preliminaryHeight
     //----------------------------------
-
+
     /**
      *  @private
      */
     private var _preliminaryHeight:Number = NaN;
-
+
     /**
      *  Provides an estimate to use for height when the "measured" bounds
-     *  of the image is requested by layout, but the image data has
+     *  of the image is requested by layout, but the image data has
      *  yet to complete loading. When NaN the measured height is 0 until
      *  the image has finished loading.
-     *
+     *
      *  @default NaN
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
      *  @productversion Flex 4.5
      */
-    public function get preliminaryHeight():Number
-    {
-        return _preliminaryHeight;
-    }
-
+    public function get preliminaryHeight():Number
+    {
+        return _preliminaryHeight;
+    }
+
     /**
      *  @private
      */
@@ -528,34 +528,34 @@
             invalidateSize();
         }
     }
-
+
     //----------------------------------
     //  preliminaryWidth
     //----------------------------------
-
+
     /**
      *  @private
      */
     private var _preliminaryWidth:Number = NaN;
-
+
     /**
      *  Provides an estimate to use for width when the "measured" bounds
-     *  of the image is requested by layout, but the image data has
+     *  of the image is requested by layout, but the image data has
      *  yet to complete loading. When NaN the measured width is 0 until
      *  the image has finished loading.
-     *
+     *
      *  @default NaN
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
      *  @productversion Flex 4.5
      */
-    public function get preliminaryWidth():Number
-    {
-        return _preliminaryWidth;
-    }
-
+    public function get preliminaryWidth():Number
+    {
+        return _preliminaryWidth;
+    }
+
     /**
      *  @private
      */
@@ -567,31 +567,35 @@
             invalidateSize();
         }
     }
-
+
     //----------------------------------
     //  scaleMode
     //----------------------------------
-
+
     /**
      *  @private
      */
     private var _scaleMode:String = BitmapScaleMode.STRETCH;
-
-    [Inspectable(category="General", enumeration="stretch,letterbox", defaultValue="stretch")]
-
-    /**
+
+    [Inspectable(category="General", enumeration="stretch,letterbox,zoom", defaultValue="stretch")]
+
+    /**
      *  Determines how the image is scaled when fillMode is set to
      *  BitmapFillMode.SCALE.
-     *
+     *
      *
When set to BitmapScaleMode.STRETCH ("stretch"),
      *  the image is stretched to fit.

      *
-     *
When set to BitmapScaleMode.LETTERBOX ("letterbox"),
-     *  the image is scaled with respect to the original unscaled image's
+     *
When set to BitmapScaleMode.LETTERBOX ("letterbox"),
+     *  the image is scaled with respect to the original unscaled image's
      *  aspect ratio.

      *
+     *
When set to BitmapScaleMode.ZOOM ("zoom"),
+     *  the image is scaled to fit with respect to the original unscaled image's
+     *  aspect ratio. This results in cropping on one axis.

+     *
      *  @default BitmapScaleMode.STRETCH
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10.1
      *  @playerversion AIR 2.0
@@ -601,32 +605,32 @@
     {
         return _scaleMode;
     }
-
+
     /**
      *  @private
      */
     public function set scaleMode(value:String):void
     {
-        if (value == _scaleMode)
+        if (value == _scaleMode)
             return;
-
+
         _scaleMode = value;
         invalidateDisplayList();
     }
-
+
     //----------------------------------
     //  smooth
     //----------------------------------
-
+
     private var _smooth:Boolean = false;
-
-    [Inspectable(category="General", enumeration="true,false", defaultValue="false")]
-
+
+    [Inspectable(category="General", enumeration="true,false", defaultValue="false")]
+
     /**
      *  @copy flash.display.GraphicsBitmapFill#smooth
      *
      *  @default false
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
@@ -640,32 +644,32 @@
             invalidateDisplayList();
         }
     }
-
+
     /**
      *  @private
      */
     public function get smooth():Boolean
     {
         return _smooth;
-    }
-
+    }
+
     //----------------------------------
     //  smoothingQuality
     //----------------------------------
-
+
     private var _smoothingQuality:String = BitmapSmoothingQuality.DEFAULT;
-
-    [Inspectable(category="General", enumeration="default,high", defaultValue="default")]
-
+
+    [Inspectable(category="General", enumeration="default,high", defaultValue="default")]
+
     /**
      *  Determines how the image is down-scaled.  When set to
      *  BitmapSmoothingQuality.HIGH, the image is resampled (if data
-     *  is from a trusted source) to achieve a higher quality result.
-     *  If set to BitmapSmoothingQuality.DEFAULT, the default stage
+     *  is from a trusted source) to achieve a higher quality result.
+     *  If set to BitmapSmoothingQuality.DEFAULT, the default stage
      *  quality for scaled bitmap fills is used.
-     *
+     *
      *  @default BitmapSmoothingQuality.DEFAULT
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
@@ -679,7 +683,7 @@
             invalidateDisplayList();
         }
     }
-
+
     /**
      *  @private
      */
@@ -687,55 +691,55 @@
     {
         return _smoothingQuality;
     }
-
+
     //----------------------------------
     //  source
     //----------------------------------
-
+
     private var _source:Object;
-
+
     [Bindable("sourceChanged")]
     [Inspectable(category="General")]
-
-    /**
-     *  The source used for the bitmap fill. The fill can render from various
-     *  graphical sources, including the following:
+
+    /**
+     *  The source used for the bitmap fill. The fill can render from various
+     *  graphical sources, including the following:
      *

      *
A Bitmap or BitmapData instance.

-     *
A class representing a subclass of DisplayObject. The BitmapFill
+     *
A class representing a subclass of DisplayObject. The BitmapFill
      *       instantiates the class and creates a bitmap rendering of it.

-     *
An instance of a DisplayObject. The BitmapFill copies it into a
+     *
An instance of a DisplayObject. The BitmapFill copies it into a
      *       Bitmap for filling.

      *
The name of an external image file.

      *

-     *
-     *
If you use an image file for the source, it can be of type PNG, GIF,
+     *
+     *
If you use an image file for the source, it can be of type PNG, GIF,
      *  or JPG.

-     *
-     *
To specify an embedded image source, you can use the @Embed directive,
+     *
+     *
To specify an embedded image source, you can use the @Embed directive,
      *  as the following example shows:
      *

      *  source="@Embed('<i>image_location</i>')"
      *

      *

-     *
-     *
The image location can be specified via a URL, URLRequest, or file
-     *  reference. If it is a file reference, its location is relative to the
+     *
+     *
The image location can be specified via a URL, URLRequest, or file
+     *  reference. If it is a file reference, its location is relative to the
      *  location of the file that is being compiled.

-     *
-     *
The BitmapImage class is designed to work with embedded images or
+     *
+     *
The BitmapImage class is designed to work with embedded images or
      *  images that are loaded at run time.

-     *
-     *
If the source is a Bitmap or BitmapData instance or is an external
-     *  image file, it is the responsibility of the caller to dispose of the
-     *  source once it is no longer needed. If ImageLoader created the BitmapData
-     *  instance, then it will dispose of the BitmapData once the source has
+     *
+     *
If the source is a Bitmap or BitmapData instance or is an external
+     *  image file, it is the responsibility of the caller to dispose of the
+     *  source once it is no longer needed. If ImageLoader created the BitmapData
+     *  instance, then it will dispose of the BitmapData once the source has
      *  changed.

-     *
+     *
      *  @see flash.display.Bitmap
      *  @see flash.display.BitmapData
      *  @see mx.graphics.BitmapFill
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
@@ -745,12 +749,12 @@
     {
         return _source;
     }
-
+
     /**
      *  @private
      */
     public function set source(value:Object):void
-    {
+    {
         if (value != _source)
         {
             // Remove listeners from any previous load instance and clear
@@ -758,10 +762,10 @@
             // for example that we do not receive further load related events
             // our previous content before we can consider the new source.
             clearLoadingContent();
-
+
             // Remove any event listeners from previous source.
             removeAddedToStageHandler(_source);
-
+
             _source = value;
             sourceInvalid = true;
             loadFailed = false;
@@ -769,61 +773,61 @@
             dispatchEvent(new Event("sourceChanged"));
         }
     }
-
+
     //----------------------------------
     //  sourceHeight
     //----------------------------------
-
+
     /**
      *  Provides the unscaled height of the original image data.
-     *
+     *
      *  @default NaN
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
      *  @productversion Flex 4.5
      */
-    public function get sourceHeight():Number
-    {
-        return imageHeight;
-    }
-
+    public function get sourceHeight():Number
+    {
+        return imageHeight;
+    }
+
     //----------------------------------
     //  sourceWidth
     //----------------------------------
-
+
     /**
      *  Provides the unscaled width of the original image data.
-     *
+     *
      *  @default NaN
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
      *  @productversion Flex 4.5
      */
-    public function get sourceWidth():Number
-    {
-        return imageWidth;
-    }
-
+    public function get sourceWidth():Number
+    {
+        return imageWidth;
+    }
+
     //----------------------------------
     //  trustedSource
     //----------------------------------
-
+
     private var _trustedSource:Boolean = true;
-
-    /**
-     *  A read-only flag denoting whether the currently loaded
-     *  content is considered loaded form a source whose security
-     *  policy allows for cross domain image access.
-     *  When false, advanced bitmap operations such as high quality scaling,
+
+    /**
+     *  A read-only flag denoting whether the currently loaded
+     *  content is considered loaded form a source whose security
+     *  policy allows for cross domain image access.
+     *  When false, advanced bitmap operations such as high quality scaling,
      *  and tiling are not permitted.  This flag is set once an
-     *  image has been fully loaded.
+     *  image has been fully loaded.
      *
      *  @default true
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 9
      *  @playerversion AIR 1.5
@@ -833,32 +837,32 @@
     {
         return _trustedSource;
     }
-
+
     //----------------------------------
     //  verticalAlign
     //----------------------------------
-
+
     /**
      *  @private
      */
     private var _verticalAlign:String = VerticalAlign.MIDDLE;
-
+
     [Inspectable(category="General", enumeration="top,bottom,middle", defaultValue="middle")]
-
-    /**
+
+    /**
      *  The vertical alignment of the content when it does not have
-     *  a one-to-one aspect ratio and scaleMode is set to
+     *  a one-to-one aspect ratio and scaleMode is set to
      *  BitmapScaleMode.LETTERBOX.
-     *
+     *
      *
Can be one of VerticalAlign.TOP ("top"),
-     *  VerticalAlign.BOTTOM ("bottom"), or
+     *  VerticalAlign.BOTTOM ("bottom"), or
      *  VerticalAlign.MIDDLE ("middle").

-     *
+     *
      *
This property is only applicable when scaleMode is set to
      *  to BitmapFillMode.SCALE ("scale").

-     *
+     *
      *  @default VerticalAlign.MIDDLE
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
@@ -868,19 +872,19 @@
     {
         return _verticalAlign;
     }
-
+
     /**
      *  @private
      */
     public function set verticalAlign(value:String):void
     {
-        if (value == _verticalAlign)
+        if (value == _verticalAlign)
             return;
-
+
         _verticalAlign = value;
         invalidateDisplayList();
     }
-
+
     /**
      *  @private
      */
@@ -890,19 +894,19 @@
             return 0;
         else if (_verticalAlign == VerticalAlign.BOTTOM)
             return 1;
-        else
+        else
             return 0.5;
     }
-
+
     //--------------------------------------------------------------------------
     //
     //  GraphicElement Overrides
     //
     //--------------------------------------------------------------------------
-
+
     /**
      *  @inheritDoc
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
@@ -913,17 +917,17 @@
         validateSource();
         super.commitProperties();
     }
-
+
     /**
      *  @inheritDoc
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
     override protected function measure():void
-    {
+    {
         var dpiScale:Number = 1;
         var app:Object = FlexGlobals.topLevelApplication;
         if ("applicationDPI" in app && "runtimeDPI" in app && source is MultiDPIBitmapSource)
@@ -938,8 +942,8 @@
             {
                 measuredWidth /= dpiScale;
                 measuredHeight /= dpiScale;
-            }
-        }
+            }
+        }
         else if (_bitmapData)
         {
             // Return size of our bitmap data.
@@ -956,69 +960,71 @@
             // If we are loading new content we keep the old measured width/height to avoid
             // sizing to 0,0 for a frame unnecessarily. Otherwise we fall back to 0 unless
             // a preliminaryWidth/Height is set.
-            var usePreviousSize:Boolean = !(_source == null || _source == "" || loadFailed);
+            var usePreviousSize:Boolean = !(_source == null || _source == "" || loadFailed);
             var previousWidth:Number = usePreviousSize ? measuredWidth : 0;
             var previousHeight:Number = usePreviousSize ? measuredHeight : 0;
-
-            measuredWidth = !isNaN(_preliminaryWidth) && (previousWidth == 0) ?
+
+            measuredWidth = !isNaN(_preliminaryWidth) && (previousWidth == 0) ?
                 _preliminaryWidth : previousWidth;
-            measuredHeight = !isNaN(_preliminaryHeight) && (previousHeight == 0) ?
+            measuredHeight = !isNaN(_preliminaryHeight) && (previousHeight == 0) ?
                 _preliminaryHeight : previousHeight;
-
+
             return;
         }
-
+
         // Consider aspectRatio
         if (maintainAspectRatio && measuredWidth > 0 && measuredHeight > 0)
         {
-            if(!isNaN(explicitWidth) && isNaN(explicitHeight) &&
+            if(!isNaN(explicitWidth) && isNaN(explicitHeight) &&
                 isNaN(percentHeight))
             {
                 measuredHeight = explicitWidth/measuredWidth * measuredHeight;
             }
-            else if (!isNaN(explicitHeight) && isNaN(explicitWidth) &&
+            else if (!isNaN(explicitHeight) && isNaN(explicitWidth) &&
                 isNaN(percentWidth))
             {
                 measuredWidth = explicitHeight/measuredHeight * measuredWidth;
             }
-            else if (!isNaN(percentWidth) && isNaN(explicitHeight) &&
+            else if (!isNaN(percentWidth) && isNaN(explicitHeight) &&
                 isNaN(percentHeight) && width > 0)
             {
                 measuredHeight = width/measuredWidth * measuredHeight;
             }
-            else if (!isNaN(percentHeight) && isNaN(explicitWidth) &&
+            else if (!isNaN(percentHeight) && isNaN(explicitWidth) &&
                 isNaN(percentWidth) && height > 0)
             {
                 measuredWidth = height/measuredHeight * measuredWidth;
             }
         }
     }
-
+
     /**
      *  @inheritDoc
-     *
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
-    override protected function updateDisplayList(unscaledWidth:Number,
+    override protected function updateDisplayList(unscaledWidth:Number,
                                                   unscaledHeight:Number):void
     {
         super.updateDisplayList(unscaledWidth, unscaledHeight);
-
+
         var adjustedHeight:Number = unscaledHeight;
         var adjustedWidth:Number = unscaledWidth;
-
+        var isZoom:Boolean = (_fillMode == BitmapFillMode.SCALE) &&
+                             (_scaleMode == BitmapScaleMode.ZOOM);
+
         // Consider aspectRatio
+        var aspectRatio:Number = unscaledWidth/unscaledHeight;
+        var imageAspectRatio:Number = imageWidth/imageHeight;
         if (maintainAspectRatio)
         {
-            var aspectRatio:Number = unscaledWidth/unscaledHeight;
-            var imageAspectRatio:Number = imageWidth/imageHeight;
             if (!isNaN(imageAspectRatio))
-            {
+            {
                 if (imageAspectRatio > aspectRatio)
-                    adjustedHeight = unscaledWidth / imageAspectRatio;
+                    adjustedHeight = unscaledWidth / imageAspectRatio;
                 else
                     adjustedWidth = unscaledHeight * imageAspectRatio;

@@ -1032,52 +1038,52 @@
                     }
                 }
             }
-        }
-
+        }
+
         if (!_bitmapData || !drawnDisplayObject || !(drawnDisplayObject is Sprite))
-        {
+        {
             if (loadedContent)
             {
-                // We are hosting a display object so let's scale, align, and clip
+                // We are hosting a display object so let's scale, align, and clip
                 // as necessary.
-
+
                 if (_fillMode == BitmapFillMode.SCALE)
                 {
                     loadedContent.width = adjustedWidth;
                     loadedContent.height = adjustedHeight;
                 }
-
+
                 loadedContent.y = loadedContent.x = 0;
-
+
                 // Align our loaded content as necessary if our width
                 // and/or height is larger than our content height.
-                if (maintainAspectRatio || _fillMode == BitmapFillMode.CLIP)
+                if (maintainAspectRatio || _fillMode == BitmapFillMode.CLIP || isZoom)
                 {
-                    var contentWidth:Number = (_fillMode == BitmapFillMode.CLIP) ?
+                    var contentWidth:Number = (_fillMode == BitmapFillMode.CLIP || isZoom) ?
                         imageWidth : adjustedWidth;
-                    var contentHeight:Number = (_fillMode == BitmapFillMode.CLIP) ?
+                    var contentHeight:Number = (_fillMode == BitmapFillMode.CLIP || isZoom) ?
                         imageHeight : adjustedHeight;
-
+
                     if (unscaledHeight > contentHeight)
-                        loadedContent.y = Math.floor((unscaledHeight - contentHeight)
+                        loadedContent.y = Math.floor((unscaledHeight - contentHeight)
                             * getVerticalAlignValue());
-
+
                     if (unscaledWidth > contentWidth)
-                        loadedContent.x = Math.floor((unscaledWidth - contentWidth)
+                        loadedContent.x = Math.floor((unscaledWidth - contentWidth)
                             * getHorizontalAlignValue());
-                }
-
+                }
+
                 // Setup clip rect if appropriate.
-                loadedContent.scrollRect = (_fillMode == BitmapFillMode.CLIP) ?
+                loadedContent.scrollRect = (_fillMode == BitmapFillMode.CLIP || isZoom) ?
                     new Rectangle(0, 0, unscaledWidth, unscaledHeight) : null;
-
+
             }
             return;
         }
-
-        // The base GraphicElement class has cleared the graphics for us.
+
+        // The base GraphicElement class has cleared the graphics for us.
         var g:Graphics = Sprite(drawnDisplayObject).graphics;
-
+
         g.lineStyle();
         var repeatBitmap:Boolean = false;
         var fillScaleX:Number = 1;
@@ -1087,33 +1093,44 @@
         var fillWidth:Number = adjustedWidth;
         var fillHeight:Number = adjustedHeight;

-        switch(_fillMode)
-        {
-            case BitmapFillMode.REPEAT:
-                if (_bitmapData)
+        if (_bitmapData)
+        {
+            switch(_fillMode)
+            {
+                case BitmapFillMode.REPEAT:
                 {
                     repeatBitmap = true;
-                }
-                break;
-
-            case BitmapFillMode.SCALE:
-                if (_bitmapData)
+                    break;
+                }
+                case BitmapFillMode.SCALE:
                 {
-                    fillScaleX = adjustedWidth / _bitmapData.width;
-                    fillScaleY = adjustedHeight / _bitmapData.height;
+                    if (isZoom)
+                    {
+                        var widthRatio:Number = adjustedWidth / _bitmapData.width;
+                        var heightRatio:Number = adjustedHeight / _bitmapData.height;
+
+                        if (widthRatio < heightRatio)
+                            fillScaleX = fillScaleY = (adjustedHeight / _bitmapData.height);
+                        else
+                            fillScaleX = fillScaleY = (adjustedWidth / _bitmapData.width);
+                    }
+                    else
+                    {
+                        fillScaleX = adjustedWidth / _bitmapData.width;
+                        fillScaleY = adjustedHeight / _bitmapData.height;
+                    }
+                    break;
                 }
-                break;
-
-            case BitmapFillMode.CLIP:
-                if (_bitmapData)
+                case BitmapFillMode.CLIP:
                 {
                     fillWidth = Math.min(adjustedWidth, _bitmapData.width);
                     fillHeight = Math.min(adjustedHeight, _bitmapData.height);
+                    break;
                 }
-                break;
-        }
-
-        // If no scaleGrid is defined or if fillMode != SCALE, just draw
+            }
+        }
+
+        // If no scaleGrid is defined or if fillMode != SCALE, just draw
         // the entire rect
         if (_fillMode != BitmapFillMode.SCALE ||
             isNaN(_scaleGridTop) ||
@@ -1121,98 +1138,121 @@
             isNaN(_scaleGridLeft) ||
             isNaN(_scaleGridRight))
         {
-            var sampledScale:Boolean = _smooth &&
+            var sampledScale:Boolean = _smooth &&
                 (_smoothingQuality == BitmapSmoothingQuality.HIGH) &&
                 (_fillMode == BitmapFillMode.SCALE);
+            var sampleWidth:Number = fillWidth;
+            var sampleHeight:Number = fillHeight;

-            var b:BitmapData = sampledScale ? resample(_bitmapData, fillWidth, fillHeight) : _bitmapData;
+            if (isZoom)
+            {
+                sampleWidth = _bitmapData.width * fillScaleX;
+                sampleHeight = _bitmapData.height * fillScaleY;
+            }
+
+            var b:BitmapData = sampledScale ? resample(_bitmapData, sampleWidth, sampleHeight) : _bitmapData;
+
+            if (sampledScale && (_fillMode == BitmapFillMode.SCALE))
+            {
+                if (isZoom)
+                {
+                    fillScaleX = fillScaleY = 1;
+                }
+                else if (_fillMode == BitmapFillMode.SCALE)
+                {
+                    fillScaleX = adjustedWidth / b.width;
+                    fillScaleY = adjustedHeight / b.height;
+                }
+            }

-            if (sampledScale && _fillMode == BitmapFillMode.SCALE)
-            {
-                fillScaleX = adjustedWidth / b.width;
-                fillScaleY = adjustedHeight / b.height;
-            }
-
-            var offsetX:Number = 0;
-            var offsetY:Number = 0;
-
+            var cHeight:Number = b.height * fillScaleX;
+            var cWidth:Number = b.width * fillScaleY;
+
             // Align our bitmap content as necessary if our width
             // and/or height is larger than our content height.
-            if (maintainAspectRatio || _fillMode == BitmapFillMode.CLIP)
-            {
-                var cHeight:Number = b.height * fillScaleX;
-                var cWidth:Number = b.width * fillScaleY;
-
+            if (maintainAspectRatio || _fillMode == BitmapFillMode.CLIP || isZoom)
+            {
                 if (unscaledHeight > cHeight)
-                    roundedDrawY = roundedDrawY + Math.floor((unscaledHeight - cHeight)
+                    roundedDrawY = roundedDrawY + Math.floor((unscaledHeight - cHeight)
                         * getVerticalAlignValue());
-
+
                 if (unscaledWidth > cWidth)
-                    roundedDrawX = roundedDrawX + Math.floor((unscaledWidth - cWidth)
+                    roundedDrawX = roundedDrawX + Math.floor((unscaledWidth - cWidth)
                         * getHorizontalAlignValue());
             }

+            var translateX:Number = roundedDrawX;
+            var translateY:Number = roundedDrawY;
+
+            if (isZoom)
+            {
+                if (cWidth > unscaledWidth)
+                    translateX = translateX + ((unscaledWidth - cWidth) * getHorizontalAlignValue());
+                else if (cHeight > unscaledHeight)
+                    translateY = translateY + ((unscaledHeight - cHeight) * getVerticalAlignValue());
+            }
+
             matrix.identity();
-            if (!(sampledScale && maintainAspectRatio))
+            if (!(sampledScale && (maintainAspectRatio || isZoom)))
                 matrix.scale(fillScaleX, fillScaleY);
-            matrix.translate(roundedDrawX, roundedDrawY);
+            matrix.translate(translateX, translateY);
             g.beginBitmapFill(b, matrix, repeatBitmap, _smooth);
             g.drawRect(roundedDrawX, roundedDrawY, fillWidth, fillHeight);
             g.endFill();
         }
         else
-        {
-            // If we have scaleGrid, we draw 9 sections, each with a different scale factor based
+        {
+            // If we have scaleGrid, we draw 9 sections, each with a different scale factor based
             // on the grid region.
-
+
             if (cachedSourceGrid == null)
             {
                 // Generate the 16 points of the source (unscaled) grid
                 cachedSourceGrid = [];
-                cachedSourceGrid.push([new Point(0, 0), new Point(_scaleGridLeft, 0),
+                cachedSourceGrid.push([new Point(0, 0), new Point(_scaleGridLeft, 0),
                     new Point(_scaleGridRight, 0), new Point(_bitmapData.width, 0)]);
-                cachedSourceGrid.push([new Point(0, _scaleGridTop), new Point(_scaleGridLeft, _scaleGridTop),
+                cachedSourceGrid.push([new Point(0, _scaleGridTop), new Point(_scaleGridLeft, _scaleGridTop),
                     new Point(_scaleGridRight, _scaleGridTop), new Point(_bitmapData.width, _scaleGridTop)]);
-                cachedSourceGrid.push([new Point(0, _scaleGridBottom), new Point(_scaleGridLeft, _scaleGridBottom),
+                cachedSourceGrid.push([new Point(0, _scaleGridBottom), new Point(_scaleGridLeft, _scaleGridBottom),
                     new Point(_scaleGridRight, _scaleGridBottom), new Point(_bitmapData.width, _scaleGridBottom)]);
-                cachedSourceGrid.push([new Point(0, _bitmapData.height), new Point(_scaleGridLeft, _bitmapData.height),
-                    new Point(_scaleGridRight, _bitmapData.height), new Point(_bitmapData.width, _bitmapData.height)]);
-            }
-
-            if (cachedDestGrid == null ||
-                previousUnscaledWidth != unscaledWidth ||
+                cachedSourceGrid.push([new Point(0, _bitmapData.height), new Point(_scaleGridLeft, _bitmapData.height),
+                    new Point(_scaleGridRight, _bitmapData.height), new Point(_bitmapData.width, _bitmapData.height)]);
+            }
+
+            if (cachedDestGrid == null ||
+                previousUnscaledWidth != unscaledWidth ||
                 previousUnscaledHeight != unscaledHeight)
             {
                 // Generate teh 16 points of the destination (scaled) grid
                 var destScaleGridBottom:Number = unscaledHeight - (_bitmapData.height - _scaleGridBottom);
-                var destScaleGridRight:Number = unscaledWidth - (_bitmapData.width - _scaleGridRight);
+                var destScaleGridRight:Number = unscaledWidth - (_bitmapData.width - _scaleGridRight);
                 cachedDestGrid = [];
-                cachedDestGrid.push([new Point(0, 0), new Point(_scaleGridLeft, 0),
+                cachedDestGrid.push([new Point(0, 0), new Point(_scaleGridLeft, 0),
                     new Point(destScaleGridRight, 0), new Point(unscaledWidth, 0)]);
-                cachedDestGrid.push([new Point(0, _scaleGridTop), new Point(_scaleGridLeft, _scaleGridTop),
+                cachedDestGrid.push([new Point(0, _scaleGridTop), new Point(_scaleGridLeft, _scaleGridTop),
                     new Point(destScaleGridRight, _scaleGridTop), new Point(unscaledWidth, _scaleGridTop)]);
-                cachedDestGrid.push([new Point(0, destScaleGridBottom), new Point(_scaleGridLeft, destScaleGridBottom),
+                cachedDestGrid.push([new Point(0, destScaleGridBottom), new Point(_scaleGridLeft, destScaleGridBottom),
                     new Point(destScaleGridRight, destScaleGridBottom), new Point(unscaledWidth, destScaleGridBottom)]);
-                cachedDestGrid.push([new Point(0, unscaledHeight), new Point(_scaleGridLeft, unscaledHeight),
-                    new Point(destScaleGridRight, unscaledHeight), new Point(unscaledWidth, unscaledHeight)]);
-            }
-
+                cachedDestGrid.push([new Point(0, unscaledHeight), new Point(_scaleGridLeft, unscaledHeight),
+                    new Point(destScaleGridRight, unscaledHeight), new Point(unscaledWidth, unscaledHeight)]);
+            }
+
             var sourceSection:Rectangle = new Rectangle();
             var destSection:Rectangle = new Rectangle();
-
+
             // Iterate over the columns and rows. We draw each of the nine sections at a calculated
-            // scale and translation.
-            for (var rowIndex:int=0; rowIndex < 3; rowIndex++)
-            {
-                for (var colIndex:int = 0; colIndex < 3; colIndex++)
-                {
+            // scale and translation.
+            for (var rowIndex:int=0; rowIndex < 3; rowIndex++)
+            {
+                for (var colIndex:int = 0; colIndex < 3; colIndex++)
+                {
                     // Create the source and destination rectangles for the current section
                     sourceSection.topLeft = cachedSourceGrid[rowIndex][colIndex];
                     sourceSection.bottomRight = cachedSourceGrid[rowIndex+1][colIndex+1];
-
+
                     destSection.topLeft = cachedDestGrid[rowIndex][colIndex];
                     destSection.bottomRight = cachedDestGrid[rowIndex+1][colIndex+1];
-
+
                     matrix.identity();
                     // Scale the bitmap by the ratio between the source and destination dimensions
                     matrix.scale(destSection.width / sourceSection.width, destSection.height / sourceSection.height);
@@ -1220,7 +1260,7 @@
                     // making sure to account for the new scale.
                     matrix.translate(destSection.x - sourceSection.x * matrix.a, destSection.y - sourceSection.y * matrix.d);
                     matrix.translate(roundedDrawX, roundedDrawY);
-
+
                     // Draw the bitmap for the current section
                     g.beginBitmapFill(_bitmapData, matrix);
                     g.drawRect(destSection.x + roundedDrawX, destSection.y + roundedDrawY, destSection.width, destSection.height);
@@ -1228,11 +1268,11 @@
                 }
             }
         }
-
+
         previousUnscaledWidth = unscaledWidth;
         previousUnscaledHeight = unscaledHeight;
-    }
-
+    }
+
     /**
      *  @private
      */
@@ -1241,54 +1281,54 @@
         // If we are hosting untrusted content the hosted loader becomes
         // our display object.
         return !trustedSource || super.needsDisplayObject;
-    }
-
+    }
+
     //--------------------------------------------------------------------------
     //
     //  Methods
     //
     //--------------------------------------------------------------------------
-
+
     /**
      *  @private
      *  Utility function that sets the underlying bitmapData property.
      */
-    protected function setBitmapData(bitmapData:BitmapData,
+    protected function setBitmapData(bitmapData:BitmapData,
                                      internallyCreated:Boolean = false):void
-    {
+    {
         // Clear previous bitmapData
         clearBitmapData();
-
+
         // Reset imageWidth/Height, as we aren't
-        // loading external content so no reason to
+        // loading external content so no reason to
         // cache our existing image width and height.
         imageWidth = imageHeight = NaN;
-
+
         // Clear any currently loading content.
         clearLoadingContent();
-
+
         if (bitmapData)
         {
-            bitmapDataCreated = internallyCreated;
-
+            bitmapDataCreated = internallyCreated;
+
             _bitmapData = bitmapData;
-
+
             imageWidth = bitmapData.width;
             imageHeight = bitmapData.height;
-
+
             // Flush the cached scale grid points
             cachedSourceGrid = null;
             cachedDestGrid = null;
-
+
             // Dispatch ready event
             dispatchEvent(new FlexEvent(FlexEvent.READY));
         }
-
+
         if (!explicitHeight || !explicitWidth)
             invalidateSize();
         invalidateDisplayList();
     }
-
+
     /**
      *  @private
      *  Utility method which analyzes our source and either acquires the
@@ -1296,35 +1336,35 @@
      *  as necessary.
      */
     mx_internal function applySource():void
-    {
+    {
         var value:Object = _source;
         var bitmapData:BitmapData;
         var tmpSprite:DisplayObject;
-
+
         if (value is MultiDPIBitmapSource)
             value = getActualValue(value as MultiDPIBitmapSource);
-
+
         // Clear the previous scaleGrid properties
         _scaleGridLeft = NaN;
         _scaleGridRight = NaN;
         _scaleGridTop = NaN;
         _scaleGridBottom = NaN;
         var currentBitmapCreated:Boolean = false;
-
+
         // Reset byte counts and _trustedSource
         _bytesLoaded = NaN;
         _bytesTotal = NaN;
         _trustedSource = true;
-
+
         // We'll need to reconsider display object sharing.
         invalidateDisplayObjectSharing();
         invalidateDisplayList();
-
+
         // Remove any previously hosted content prior to loading
         // new content (if applicable).
         if (_clearOnLoad)
             removePreviousContent();
-
+
         if (value is Class)
         {
             var cls:Class = Class(value);
@@ -1339,7 +1379,7 @@
         {
             loadFromBytes(value as ByteArray);
         }
-
+
         if (value is BitmapData)
         {
             bitmapData = value as BitmapData;
@@ -1351,43 +1391,43 @@
         else if (value is DisplayObject)
         {
             tmpSprite = value as DisplayObject;
-
+
             if ((tmpSprite.width == 0 || tmpSprite.height == 0) && !tmpSprite.stage )
             {
-                // If our source DisplayObject has yet to be assigned a stage,
-                // and doesn't have valid bounds, it is not ready to be captured,
+                // If our source DisplayObject has yet to be assigned a stage,
+                // and doesn't have valid bounds, it is not ready to be captured,
                 // so we defer bitmap capture until it is added to the display list.
                 tmpSprite.addEventListener(Event.ADDED_TO_STAGE, source_addedToStageHandler);
                 return;
-            }
+            }
         }
         else if (value == null)
         {
             // This will set source to null
-        }
+        }
         else
         {
             // We're loading external content or we
             // we have an unsupported source value.
             return;
         }
-
+
         if (!bitmapData && tmpSprite)
         {
             // We must ensure any IInvalidating sources
             // are properly validated before capturing.
             if (tmpSprite is IInvalidating)
                 IInvalidating(tmpSprite).validateNow();
-
+
             // Return immediately if our input source has 0 bounds else
             // our BitmapData constructor will RTE.
             if (tmpSprite.width == 0 || tmpSprite.height == 0)
                 return;
-
+
             bitmapData = new BitmapData(tmpSprite.width, tmpSprite.height, true, 0);
             bitmapData.draw(tmpSprite, new Matrix(), tmpSprite.transform.colorTransform);
             currentBitmapCreated = true;
-
+
             if (tmpSprite.scale9Grid)
             {
                 _scaleGridLeft = tmpSprite.scale9Grid.left;
@@ -1396,15 +1436,15 @@
                 _scaleGridBottom = tmpSprite.scale9Grid.bottom;
             }
         }
-
+
         // Remove any previously hosted content prior to assigning
         // new bitmap data (if we haven't already previously).
         if (!_clearOnLoad)
             removePreviousContent();
-
+
         setBitmapData(bitmapData, currentBitmapCreated);
     }
-
+
     /**
      *  @private
      *  Figure out which source to use
@@ -1424,18 +1464,18 @@
      *  @private
      */
     mx_internal function loadExternal(source:Object):void
-    {
+    {
         // Ensure we handle unicode characters properly.
         if (source is String)
         {
            var url:String = source as String;
            source = LoaderUtil.OSToPlayerURI(url, LoaderUtil.isLocal(url));
         }
-
+
         if (contentLoader)
         {
             // We defer our load request to the configured content loader.
-            var contentRequest:ContentRequest = contentLoader.load(source, contentLoaderGrouping);
+            var contentRequest:ContentRequest = contentLoader.load(source, contentLoaderGrouping);

             if (contentRequest.complete)
             {
@@ -1454,15 +1494,15 @@
         {
             var loader:Loader = new Loader();
             var loaderContext:LoaderContext = new LoaderContext();
-
+
             // Attach load-event listeners to our LoaderInfo instance.
             loadingContent = loader.contentLoaderInfo;
             attachLoadingListeners();
-
+
             try
             {
                 loaderContext.checkPolicyFile = true;
-                var urlRequest:URLRequest = source is URLRequest ?
+                var urlRequest:URLRequest = source is URLRequest ?
                     source as URLRequest : new URLRequest(source as String);
                 loader.load(urlRequest, loaderContext);
             }
@@ -1472,17 +1512,17 @@
             }
         }
     }
-
+
     /**
      *  @private
      */
     mx_internal function loadFromBytes(source:ByteArray):void
-    {
-        var loader:Loader = new Loader();
+    {
+        var loader:Loader = new Loader();
         var loaderContext:LoaderContext = new LoaderContext();
         loadingContent = loader.contentLoaderInfo;
         attachLoadingListeners();
-
+
         try
         {
             loader.loadBytes(source as ByteArray, loaderContext);
@@ -1492,62 +1532,62 @@
             handleSecurityError(error);
         }
     }
-
+
     /**
      * @private
      * Utility function used for higher quality image scaling. Essentially we
      * simply step down our bitmap size by half resulting in a much higher result
      * though taking potentially multiple passes to accomplish.
      */
-    protected static function resample(bitmapData:BitmapData, newWidth:uint,
+    protected static function resample(bitmapData:BitmapData, newWidth:uint,
                                        newHeight:uint):BitmapData
     {
-        var finalScale:Number = Math.max(newWidth/bitmapData.width,
+        var finalScale:Number = Math.max(newWidth/bitmapData.width,
             newHeight/bitmapData.height);
-
+
         var finalData:BitmapData = bitmapData;
-
-        if (finalScale > 1)
-        {
-            finalData = new BitmapData(bitmapData.width * finalScale,
+
+        if (finalScale > 1)
+        {
+            finalData = new BitmapData(bitmapData.width * finalScale,
                 bitmapData.height * finalScale, true, 0);
-
-            finalData.draw(bitmapData, new Matrix(finalScale, 0, 0,
+
+            finalData.draw(bitmapData, new Matrix(finalScale, 0, 0,
                 finalScale), null, null, null, true);
-
+
             return finalData;
         }
-
+
         var drop:Number = .5;
         var initialScale:Number = finalScale;
-
-        while (initialScale/drop < 1)
+
+        while (initialScale/drop < 1)
             initialScale /= drop;
-
-        var w:Number = Math.floor(bitmapData.width * initialScale);
-        var h:Number = Math.floor(bitmapData.height * initialScale);
+
+        var w:Number = Math.floor(bitmapData.width * initialScale);
+        var h:Number = Math.floor(bitmapData.height * initialScale);
         var bd:BitmapData = new BitmapData(w, h, bitmapData.transparent, 0);
-
-        bd.draw(finalData, new Matrix(initialScale, 0, 0, initialScale),
+
+        bd.draw(finalData, new Matrix(initialScale, 0, 0, initialScale),
             null, null, null, true);
         finalData = bd;
-
-        for (var scale:Number = initialScale * drop;
-            Math.round(scale * 1000) >= Math.round(finalScale * 1000);
-            scale *= drop)
+
+        for (var scale:Number = initialScale * drop;
+            Math.round(scale * 1000) >= Math.round(finalScale * 1000);
+            scale *= drop)
         {
             w = Math.floor(bitmapData.width * scale);
             h = Math.floor(bitmapData.height * scale);
             bd = new BitmapData(w, h, bitmapData.transparent, 0);
-
+
             bd.draw(finalData, new Matrix(drop, 0, 0, drop), null, null, null, true);
             finalData.dispose();
             finalData = bd;
-        }
-
+        }
+
         return finalData;
     }
-
+
     /**
      * @private
      * Invoked upon completion of a load request.
@@ -1559,44 +1599,44 @@
             // Clear any previous bitmap data or loader instance.
             setBitmapData(null);
             removePreviousContent();
-
+
             var loaderInfo:LoaderInfo = content as LoaderInfo;
-
-            if (loaderInfo.childAllowsParent)
+
+            if (loaderInfo.childAllowsParent)
             {
                 // For trusted content we adopt the loaded BitmapData.
                 var image:Bitmap = Bitmap(loaderInfo.content);
                 setBitmapData(image.bitmapData);
-            }
-            else
+            }
+            else
             {
                 // For untrusted content we must host the acquired Loader
-                // instance directly as our DisplayObject.
+                // instance directly as our DisplayObject.
                 displayObjectSharingMode = DisplayObjectSharingMode.OWNS_UNSHARED_OBJECT;
                 invalidateDisplayObjectSharing();
-
+
                 // Create a content holder to use as our display object.
                 var contentHolder:Sprite = new Sprite();
-                setDisplayObject(contentHolder);
+                setDisplayObject(contentHolder);
                 loadedContent = loaderInfo.loader;
                 contentHolder.addChild(loadedContent);
-
+
                 // Retain our source image width and height.
-                imageWidth = loaderInfo.width;
+                imageWidth = loaderInfo.width;
                 imageHeight = loaderInfo.height ;
-
+
                 // Update
                 if (!explicitHeight || !explicitWidth)
                     invalidateSize();
-                invalidateDisplayList();
-
+                invalidateDisplayList();
+
                 // Denote that we are hosting an untrusted image and as such some
                 // features requiring access to the bitmap data will no longer
                 // function.
-                _trustedSource = false;
-
+                _trustedSource = false;
+
                 // Dispatch ready event
-                dispatchEvent(new FlexEvent(FlexEvent.READY));
+                dispatchEvent(new FlexEvent(FlexEvent.READY));
             }
         }
         else
@@ -1605,20 +1645,20 @@
                 setBitmapData(content as BitmapData);
         }
     }
-
+
     /**
      * @private
      * Returns true if are to consider aspect ratio while scaling.
-     */
+     */
     private function get maintainAspectRatio():Boolean
     {
         return (_scaleMode == BitmapScaleMode.LETTERBOX && _fillMode == BitmapFillMode.SCALE);
     }
-
+
     /**
      * @private
      * Removes any previously loaded content prior to loading new.
-     */
+     */
     private function removePreviousContent():void
     {
         if (loadedContent && loadedContent.parent)
@@ -1636,7 +1676,7 @@
             clearBitmapData();
         }
     }
-
+
     /**
      *  @private
      */
@@ -1650,14 +1690,14 @@
             }
             catch (e:Error)
             {
-                // Ignore
-            }
-        }
-
+                // Ignore
+            }
+        }
+
         removeLoadingListeners();
         loadingContent = null;
     }
-
+
     /**
      *  @private
      */
@@ -1666,12 +1706,12 @@
         if (_bitmapData)
         {
             // Dispose the bitmap if we created it
-            if (bitmapDataCreated)
+            if (bitmapDataCreated)
                 _bitmapData.dispose();
             _bitmapData = null;
         }
     }
-
+
     /**
      *  @private
      */
@@ -1679,19 +1719,19 @@
     {
         if (loadingContent)
         {
-            loadingContent.addEventListener(Event.COMPLETE,
+            loadingContent.addEventListener(Event.COMPLETE,
                 loader_completeHandler, false, 0, true);
-            loadingContent.addEventListener(IOErrorEvent.IO_ERROR,
+            loadingContent.addEventListener(IOErrorEvent.IO_ERROR,
                 loader_ioErrorHandler, false, 0, true);
-            loadingContent.addEventListener(ProgressEvent.PROGRESS,
+            loadingContent.addEventListener(ProgressEvent.PROGRESS,
                 loader_progressHandler, false, 0, true);
-            loadingContent.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
+            loadingContent.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
                 loader_securityErrorHandler, false, 0, true);
-            loadingContent.addEventListener(HTTPStatusEvent.HTTP_STATUS,
+            loadingContent.addEventListener(HTTPStatusEvent.HTTP_STATUS,
                 dispatchEvent, false, 0, true);
         }
     }
-
+
     /**
      *  @private
      */
@@ -1699,27 +1739,27 @@
     {
         if (loadingContent)
         {
-            loadingContent.removeEventListener(Event.COMPLETE,
+            loadingContent.removeEventListener(Event.COMPLETE,
                 loader_completeHandler);
-            loadingContent.removeEventListener(IOErrorEvent.IO_ERROR,
+            loadingContent.removeEventListener(IOErrorEvent.IO_ERROR,
                 loader_ioErrorHandler);
-            loadingContent.removeEventListener(ProgressEvent.PROGRESS,
+            loadingContent.removeEventListener(ProgressEvent.PROGRESS,
                 loader_progressHandler);
-            loadingContent.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,
+            loadingContent.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,
                 loader_securityErrorHandler);
-            loadingContent.removeEventListener(HTTPStatusEvent.HTTP_STATUS,
+            loadingContent.removeEventListener(HTTPStatusEvent.HTTP_STATUS,
                 dispatchEvent);
         }
     }
-
-
+
+
     /**
      *  @private
      *  Utility method which is invoked to initiate loading of our
      *  source.
      */
     mx_internal function validateSource():void
-    {
+    {
         if (sourceInvalid || contentLoaderInvalid)
         {
             applySource();
@@ -1727,13 +1767,13 @@
             contentLoaderInvalid = false;
         }
     }
-
+
     //--------------------------------------------------------------------------
     //
     //  Event handlers
     //
     //--------------------------------------------------------------------------
-
+
     /**
      *  @private
      */
@@ -1741,9 +1781,9 @@
     {
         try
         {
-            var loaderInfo:LoaderInfo = (event.target is ContentRequest) ?
+            var loaderInfo:LoaderInfo = (event.target is ContentRequest) ?
                 event.target.content as LoaderInfo : event.target as LoaderInfo;
-
+
             if (loaderInfo.bytesLoaded)
             {
                 _bytesLoaded = _bytesTotal;
@@ -1753,80 +1793,80 @@
         catch (error:SecurityError)
         {
             handleSecurityError(error);
-        }
-
+        }
+
         dispatchEvent(event);
-
+
         // Remove any event listeners from load-event dispatcher.
         clearLoadingContent();
     }
-
+
     /**
      *  @private
      */
     private function loader_ioErrorHandler(error:IOErrorEvent):void
-    {
+    {
         // forward the event, only in the case of a listener, else
         // an RTE will occur.
         if (hasEventListener(error.type))
             dispatchEvent(error);
-
-        // clear any current image and remove any event listeners from
+
+        // clear any current image and remove any event listeners from
         // load-event  dispatcher.
         setBitmapData(null);
         loadFailed = true;
     }
-
+
     /**
      *  @private
      */
     private function loader_securityErrorHandler(error:SecurityErrorEvent):void
-    {
+    {
         dispatchEvent(error);
-
-        // clear any current image and remove any event listeners from
+
+        // clear any current image and remove any event listeners from
         // load-event  dispatcher.
         setBitmapData(null);
         loadFailed = true;
     }
-
+
     /**
      *  @private
      */
     private function loader_progressHandler(progressEvent:ProgressEvent):void
-    {
+    {
         _bytesLoaded = progressEvent.bytesLoaded;
         _bytesTotal = progressEvent.bytesTotal;
-
+
         // forward the event
         dispatchEvent(progressEvent);
     }
-
+
     /**
      *  @private
      */
     private function handleSecurityError(error:SecurityError):void
     {
-        dispatchEvent(new SecurityErrorEvent(SecurityErrorEvent.SECURITY_ERROR,
+        dispatchEvent(new SecurityErrorEvent(SecurityErrorEvent.SECURITY_ERROR,
             false, false, error.message));
-
-        // clear any current image and remove any event listeners from
+
+        // clear any current image and remove any event listeners from
         // load-event  dispatcher.
-        setBitmapData(null);
+        setBitmapData(null);
         loadFailed = true;
     }
-
-    /**
-     *  @private
-     *  Used for deferral of bitmap capture when an assigned source
-     *  has yet to be added to the stage.
+
+    /**
+     *  @private
+     *  Used for deferral of bitmap capture when an assigned source
+     *  has yet to be added to the stage.
      */
     private function source_addedToStageHandler(event:Event):void
     {
         removeAddedToStageHandler(event.target);
         applySource();
     }
-
+
     /**
      *  @private
      */
@@ -1835,5 +1875,5 @@
         if (target && target is DisplayObject)
             target.removeEventListener(Event.ADDED_TO_STAGE, source_addedToStageHandler);
     }
-}
 }
+}


change space to tab

change space to tab

--- flash-src/PusherAS/src/io/rocketengine/pusheras/Pusher.as
+++ flash-src/PusherAS/src/io/rocketengine/pusheras/Pusher.as
@@ -290,9 +290,9 @@
 			var pusherEvent:PusherEvent = new PusherEvent(PusherEvent.SUBSCRIBE);
 			pusherEvent.data.channel = pusherChannel.name;
 			if (pusherChannel.authenticationSignature.indexOf(_pusherOptions.applicationKey + ':') == 0)
-          pusherEvent.data.auth = pusherChannel.authenticationSignature;
-      else
-          pusherEvent.data.auth = _pusherOptions.applicationKey + ':' + pusherChannel.authenticationSignature;
+				pusherEvent.data.auth = pusherChannel.authenticationSignature;
+			else
+				pusherEvent.data.auth = _pusherOptions.applicationKey + ':' + pusherChannel.authenticationSignature;

 			// dispatch event to pusher service


Transferred from the Adobe Open Source Subversion Repository

Revision: 23246
Author:   cframpto@adobe.com
Date:     2011-12-20T17:40:08.069454Z

Log Message:
-----------
Rollback 23243.  If comment followed header it was stripped as well.

Modified Paths:
--------------
2361 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1248728 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/advancedgrids/src/mx/olap/IOLAPSet.as
+++ frameworks/projects/advancedgrids/src/mx/olap/IOLAPSet.as
@@ -1,3 +1,13 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2009 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////

 package mx.olap
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 19231
Author:   jszeto@adobe.com
Date:     2010-12-09T19:25:51.943016Z

Log Message:
-----------
Mobile Skin Fixes

Merging in revisions 18989-19158 from hero_skin_sandbox.

The following component skins have been updated and 320 DPI skins added:

Button
CheckBox
RadioButton
TextInput
TextArea
ActionBar
HSlider

Updating MobileSkins test project

QE notes: baseline regen
Doc notes: none
Bugs: none
Reviewer: Jason San Jose, Tom Krakit
Tests run: full cyclone
Is noteworthy for integration: yes, updated skins!

Modified Paths:
--------------
129 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1265060 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mobiletheme/src/MobileThemeClasses.as
+++ frameworks/projects/mobiletheme/src/MobileThemeClasses.as
@@ -24,6 +24,7 @@
 import spark.skins.mobile.ActionBarSkin; ActionBarSkin;
 import spark.skins.mobile.ActionButtonSkin; ActionButtonSkin;
 import spark.skins.mobile.NavigationButtonSkin; NavigationButtonSkin;
+import spark.skins.mobile.NavigationAngledButtonSkin; NavigationAngledButtonSkin;
 import spark.skins.mobile.ButtonSkin; spark.skins.mobile.ButtonSkin;
 import spark.skins.mobile.CheckBoxSkin; spark.skins.mobile.CheckBoxSkin;
 import spark.skins.mobile.RadioButtonSkin; spark.skins.mobile.RadioButtonSkin;


Transferred from the Adobe Open Source Subversion Repository

Revision: 5908
Author:   smgilson@adobe.com
Date:     2009-04-03T14:45:19.262491Z

Log Message:
-----------
Some ASDoc clean up post merge

QE Notes: None
Doc Notes: None
Bugs: -
Checkintests: passed

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/Label.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/PopUpButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/PopUpMenuButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/utilities/src/com/adobe/viewsource/ViewSource.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1268401 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mx/src/mx/controls/PopUpMenuButton.as
+++ frameworks/projects/mx/src/mx/controls/PopUpMenuButton.as
@@ -359,16 +359,17 @@
      *  show for each menu item.
      *  The iconFunction property, if set, overrides this property.
      *
-     *
The renderers will look in the data provider object for a property of
-     *  the name supplied as the iconField.  If the value of the property is a
-     *  Class, it will instantiate that class and expect it to be an instance
+     *
The item renderer looks in the data provider for a property with
+     *  the name specified to the iconField property.
+     *  If the value of the property is a
+     *  Class, it instantiates that class and expect it to be an instance
      *  of an IFlexDisplayObject. If the value of the property is a String,
-     *  it will look to see if a Class exists with that name in the application,
-     *  and if it can't find one, it will also look for a property on the
+     *  it looks to see if a Class property exists with that name in the application.
+     *  If it can't find a property on the application, it looks for a property on the
      *  document with that name and expect that property to map to a Class.

      *
-     *  If the data provider is an E4X XML object, you must set this property
-     *  explicitly; for example, use @icon to specify the icon attribute.
+     *
If the data provider is an E4X XML object, you must set this property
+     *  explicitly; for example, use @icon to specify the icon attribute.

      *
      *  @default "icon"
      */
@@ -412,13 +413,13 @@
      *  If you specify this property, Flex ignores any iconField
      *  property value.
      *
-     *  By default the menu does not try to display icons with the text
+     *
By default, the menu does not try to display icons with the text
      *  in the rows.  However, by specifying an icon function, you can specify
      *  a Class for a graphic that will be created and displayed as an icon
-     *  in the row.
+     *  in the row.

      *
      *
The iconFunction takes a single argument which is the item
-     *  in the data provider and returns a Class.

+     *  in the data provider and returns a Class:

      *
      *

      *  iconFunction(item:Object):Class
@@ -637,18 +638,18 @@
      */
     override protected function commitProperties():void
     {
-    	if (dataProviderChanged && !popUpMenu)
-    	{
-    		// In general we shouldn't create the popUp until
-	        // they are actually popped up. However, in this case
-	        // the initial label, icon and action on the main button's
-	        // click are to be borrowed from the popped menu.
-	        // Moreover since PopUpMenuButton doesn't expose selectedIndex
-	        // selectedItem etc., one should be able to access them
-	        // prior to popping up the menu.
-	        getPopUp();
-    	}
-
+        if (dataProviderChanged && !popUpMenu)
+        {
+            // In general we shouldn't create the popUp until
+            // they are actually popped up. However, in this case
+            // the initial label, icon and action on the main button's
+            // click are to be borrowed from the popped menu.
+            // Moreover since PopUpMenuButton doesn't expose selectedIndex
+            // selectedItem etc., one should be able to access them
+            // prior to popping up the menu.
+            getPopUp();
+        }
+
         if (_showRootChanged)
         {
             _showRootChanged = false;


Transferred from the Adobe Open Source Subversion Repository

Revision: 23243
Author:   cframpto@adobe.com
Date:     2011-12-20T00:59:57.384047Z

Log Message:
-----------
In frameworks, remove Adobe headers from all files except xml/mxml file types.  There are also a few .txt files that are license files that I didn't touch yet.

Modified Paths:
--------------
2361 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1269872 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mx/src/mx/skins/halo/PopUpMenuIcon.as
+++ frameworks/projects/mx/src/mx/skins/halo/PopUpMenuIcon.as
@@ -1,13 +1,3 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2005-2006 Adobe Systems Incorporated
-//  All Rights Reserved.
-//
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
-//
-////////////////////////////////////////////////////////////////////////////////

 package mx.skins.halo
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 11639
Author:   jszeto@adobe.com
Date:     2009-11-11T01:07:34.029444Z

Log Message:
-----------
ComboBox bug fix

SDK-24104 - ComboBox should scroll the matched item to the top of the list

Made an mx_internal version of LayoutBase.getScrollPositionDeltaToElementHelper that supports aligning the position to an edge. ComboBox and DropDownList scroll the highlighted item to the top except when using the navigation keys to navigate while the dropDown is open.

Removed a bunch of comments and trace statements from ComboBox.

QE notes: None
Doc notes: None
Bugs: SDK-24104
Reviewer: Evtim
Tests run: ComboBox, DropDownList
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/ComboBox.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/layouts/supportClasses/LayoutBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/layouts/HorizontalLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/layouts/VerticalLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/DropDownListBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/layouts/TileLayout.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1285233 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/layouts/TileLayout.as
+++ frameworks/projects/spark/src/spark/layouts/TileLayout.as
@@ -1811,7 +1811,7 @@
     /**
      *  @private
      */
-    override protected function getElementBounds(index:int):Rectangle
+    override public function getElementBounds(index:int):Rectangle
     {
         if (!useVirtualLayout)
             return super.getElementBounds(index);


Flump exporter: fix DisplayCreator

Flump exporter: fix DisplayCreator

--- exporter/src/main/as/flump/export/DisplayCreator.as
+++ exporter/src/main/as/flump/export/DisplayCreator.as
@@ -8,8 +8,12 @@

 import flash.utils.Dictionary;

+import flump.display.ImageCreator;
+
 import flump.display.Library;
 import flump.display.Movie;
+import flump.display.MovieCreator;
+import flump.display.SymbolCreator;
 import flump.export.texturepacker.TexturePacker;
 import flump.mold.AtlasMold;
 import flump.mold.AtlasTextureMold;
@@ -31,16 +35,22 @@

         const atlases :Vector.<Atlas> = TexturePacker.withLib(lib).createAtlases();
         for each (var atlas :Atlas in atlases) {
-            var mold :AtlasMold = atlas.toMold();
+            var atlastMold :AtlasMold = atlas.toMold();
             var baseTexture :Texture = AtlasUtil.toTexture(atlas);
             _baseTextures.push(baseTexture);
-            for each (var atlasTexture :AtlasTextureMold in mold.textures) {
+            for each (var atlasTexture :AtlasTextureMold in atlastMold.textures) {
                 var tex :Texture = Texture.fromTexture(baseTexture, atlasTexture.bounds);
-                var creator :ImageCreator =
-                    new ImageCreator(tex, atlasTexture.origin, atlasTexture.symbol);
-                _imageCreators[atlasTexture.symbol] = creator;
+                _creators[atlasTexture.symbol] = new ImageCreator(tex, atlasTexture.origin, atlasTexture.symbol);
             }
         }
+
+        for each (var movieMold :MovieMold in lib.movies) {
+            _creators[movieMold.id] = new MovieCreator(movieMold, lib.frameRate);
+        }
+    }
+
+    public function getSymbolCreator (symbol :String) :SymbolCreator {
+        return _creators[symbol];
     }

     public function get imageSymbols () :Vector.<String> {
@@ -66,8 +76,8 @@
     }

     public function createDisplayObject (id :String) :DisplayObject {
-        const imageCreator :ImageCreator = ImageCreator(_imageCreators[id]);
-        return (imageCreator != null ? imageCreator.create() : createMovie(id));
+        var creator :SymbolCreator = _creators[id];
+        return creator.create(this);
     }

     public function createImage (id :String) :Image {
@@ -75,7 +85,7 @@
     }

     public function getImageTexture (id :String) :Texture {
-        return ImageCreator(_imageCreators[id]).texture;
+        return ImageCreator(_creators[id]).texture;
     }

     public function createMovie (name :String) :Movie {
@@ -108,7 +118,7 @@
                 tex.dispose();
             }
             _baseTextures = null;
-            _imageCreators = null;
+            _creators = null;
         }
     }

@@ -121,7 +131,7 @@
     public function getMaxDrawn (id :String) :int { return _maxDrawn.get(id); }

     protected function loadTexture (symbol :String) :DisplayObject {
-        return ImageCreator(_imageCreators[symbol]).create();
+        return ImageCreator(_creators[symbol]).create(this);
     }

     protected function calcMaxDrawn (id :String) :int {
@@ -144,41 +154,13 @@
     }

     private function getStarlingTexture (symbol :String) :Texture {
-        if (!_imageCreators.hasOwnProperty(symbol)) {
-            return null;
-        }
-        return ImageCreator(_imageCreators[symbol]).texture;
+        var imageCreator :ImageCreator = _creators[symbol] as ImageCreator;
+        return (imageCreator != null ? imageCreator.texture : null);
     }

     protected const _maxDrawn :Map = ValueComputingMap.newMapOf(String, calcMaxDrawn);
     protected var _baseTextures :Vector.<Texture> = new <Texture>[];
-    protected var _imageCreators :Dictionary = new Dictionary(); //<name, ImageCreator>
+    protected var _creators :Dictionary = new Dictionary(); // <name, ImageCreator|MovieCreator>
     protected var _lib :XflLibrary;
 }
 }
-
-import flash.geom.Point;
-
-import starling.display.DisplayObject;
-import starling.display.Image;
-import starling.textures.Texture;
-
-class ImageCreator {
-    public var texture :Texture;
-    public var origin :Point;
-    public var symbol :String;
-
-    public function ImageCreator (texture :Texture, origin :Point, symbol :String) {
-        this.texture = texture;
-        this.origin = origin;
-        this.symbol = symbol;
-    }
-
-    public function create () :DisplayObject {
-        const image :Image = new Image(texture);
-        image.pivotX = origin.x;
-        image.pivotY = origin.y;
-        image.name = symbol;
-        return image;
-    }
-}


Improved IMem behavior for non-instruction cases

--- src/Modules/InstructionMemory.as
+++ src/Modules/InstructionMemory.as
@@ -20,34 +20,21 @@
 		}

 		override public function renderName():String {
-			var out:String = "IMEM\n\n" + controls[0].getValue()+": ";
-
-			var instrValue:InstructionValue = instruction;
-			if (instrValue)
-				out += instrValue;
-			else
-				out += OpcodeValue.OP_NOOP;
-
-			return out;
+			return "IMEM\n\n" + controls[0].getValue()+": "+value;
 		}

 		override public function getDescription():String {
 			return "Outputs the opcode, source, target & destination of the instruction at the specified line."
 		}

-		override public function drive(port:Port):Value {
-			var line:Value = controls[0].getValue();
-			if (line.unpowered || line.unknown) return line;
-
-			var index:int = line.toNumber();
-			if (index >= U.state.memory.length)
+		override public function drive(port:Port):Value {
+			var memoryValue:Value = value;
+			if (!memoryValue)
+				return U.V_UNPOWERED;
+			if (!(memoryValue is InstructionValue))
 				return U.V_UNKNOWN;

-			var memoryValue:Value = U.state.memory[index];
-			if (!memoryValue)
-				return U.V_UNKNOWN;
-
-			var instrValue:InstructionValue = InstructionValue.fromValue(memoryValue);
+			var instrValue:InstructionValue = memoryValue as InstructionValue;

 			var portIndex:int = outputs.indexOf(port);
 			switch (portIndex) {
@@ -55,24 +42,19 @@
 				case 1: return instrValue.sourceArg;
 				case 2: return instrValue.targetArg;
 				case 3: return instrValue.destArg;
+				default: return null; //crashme!
 			}
-
-			return null; //crashme!
 		}

-		protected function get instruction():InstructionValue {
+		protected function get value():Value {
 			var line:Value = controls[0].getValue();
-			if (line.unpowered || line.unknown) return null;
+			if (line.unpowered || line.unknown) return line;

 			var index:int = line.toNumber();
-			if (index >= U.state.memory.length)
-				return null;
+			if (index >= U.state.memory.length || index < 0)
+				return U.V_UNPOWERED;

-			var memoryValue:Value = U.state.memory[index];
-			if (!memoryValue)
-				return null;
-
-			return InstructionValue.fromValue(memoryValue);
+			return U.state.memory[index];
 		}
 	}


Added Namespace to XMLClasses

Added Namespace to XMLClasses

--- frameworks/projects/XML/src/main/flex/XMLClasses.as
+++ frameworks/projects/XML/src/main/flex/XMLClasses.as
@@ -31,6 +31,7 @@
 		import XML; XML;
 		import XMLList; XMLList;
 		import QName; QName;
+		import Namespace; Namespace;
 	}
 }
 }


Transferred from the Adobe Open Source Subversion Repository

Revision: 23247
Author:   cframpto@adobe.com
Date:     2011-12-20T19:21:13.134833Z

Log Message:
-----------
Remove ADOBE SYSTEMS license and replace with Apache license in headers - frameworks.  A 2nd pass will be needed to get the files not handled up by the scripts.

Modified Paths:
--------------
4959 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1274503 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/rpc/src/mx/rpc/wsdl/WSDLPort.as
+++ frameworks/projects/rpc/src/mx/rpc/wsdl/WSDLPort.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2006-2007 Adobe Systems Incorporated
-//  All Rights Reserved.
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
 //
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////


Transferred from the Adobe Open Source Subversion Repository

Revision: 2464
Author:   jimurphy@adobe.com
Date:     2008-07-14T19:50:33.449468Z

Log Message:
-----------
add flex 4 to trunk

Modified Paths:
--------------
134 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1283361 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/core/Version.as
+++ frameworks/projects/spark/src/spark/core/Version.as
@@ -0,0 +1,18 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2008 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+import mx.core.mx_internal;
+
+/**
+ *  @private
+ *  Version string for this class.
+ */
+mx_internal static const VERSION:String = "4.0.0.0";


Removed unused isPartyGame().
(Now things use getMatchType()).

git-svn-id: a3e1eb16dde062992de22c830ed8045c8013209a@504 c613c5cb-e716-0410-b11b-feb51c14d237

--- src/as/com/threerings/ezgame/data/EZGameConfig.as
+++ src/as/com/threerings/ezgame/data/EZGameConfig.as
@@ -105,12 +105,6 @@
         out.writeObject(_gameDef);
     }

-    /** Returns true if this is a party game, false otherwise. */
-    public function isPartyGame () :Boolean
-    {
-        return getMatchType() == PARTY;
-    }
-
     // from PlaceConfig
     override public function createController () :PlaceController
     {


Transferred from the Adobe Open Source Subversion Repository

Revision: 18685
Author:   chiedozi@adobe.com
Date:     2010-11-17T23:41:28.244847Z

Log Message:
-----------
MobileApplication classes have been renamed to ViewNavigatorApplication.  Specific file changes are:
MobileApplicationBase  -->  ViewNavigatorApplicationBase
MobileApplication --> ViewNavigatorApplication
MobileApplicationSkin -->  ViewNavigatorApplicationSkin
TabbedMobileApplication -->  TabbedViewNavigatorApplication
TabbedMobileApplicationSkin --> TabbedViewNavigatorApplicationSkin

QE notes:
Doc notes:
Bugs:
Reviewer: Jason SJ
Tests run: checkintests
Is noteworthy for integration: Yes

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/manifest.xml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/tests/performance/mobile/TwitterSearch/src/TwitterSearchVirtualizedASTextField.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/tests/performance/mobile/TwitterSearch/src/TwitterSearchVirtualizedMXMLLabel.mxml</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/TabbedMobileApplication.as" copyfrom-rev="18641" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/TabbedViewNavigatorApplication.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/defaults.css</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/ViewMenuItem.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/tests/performance/mobile/RadioStations/src/RadioStations.mxml</path>
<path kind="file" action="D">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/MobileApplicationBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/tests/performance/mobile/TwitterSearch/src/TwitterSearchVirtualizedMXMLTextField.mxml</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/MobileApplicationSkin.as" copyfrom-rev="18641" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/ViewNavigatorApplicationSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/managers/PersistenceManager.as</path>
<path kind="file" action="D">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/MobileApplication.as</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/MobileApplicationBase.as" copyfrom-rev="18641" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewNavigatorApplicationBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/ViewMenu.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/ActionBar.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/tests/performance/mobile/ComponentCatalog/src/ComponentCatalog.mxml</path>
<path kind="file" action="D">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/TabbedMobileApplicationSkin.as</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/MobileApplication.as" copyfrom-rev="18641" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/ViewNavigatorApplication.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewNavigatorBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/tests/performance/mobile/TwitterSearch/src/TwitterSearchASLabel.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/MobileThemeClasses.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/tests/performance/mobile/TextTest/src/TextTest.mxml</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/TabbedMobileApplicationSkin.as" copyfrom-rev="18641" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/TabbedViewNavigatorApplicationSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/tests/performance/mobile/TwitterSearch/src/TwitterSearchASTextField.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/tests/performance/mobile/TwitterSearch/src/TwitterSearchMXMLLabel.mxml</path>
<path kind="file" action="D">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/TabbedMobileApplication.as</path>
<path kind="dir" action="D">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/core/managers</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/managers/IPersistenceManager.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/tests/performance/mobile/TwitterSearch/src/TwitterSearchMXMLTextField.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/tests/performance/mobile/TwitterSearch/src/TwitterSearchVirtualizedASLabel.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/tests/performance/mobile/TransitionTests/src/TransitionTests.mxml</path>
<path kind="dir" copyfrom-path="/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/core/managers" copyfrom-rev="18641" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/managers</path>
<path kind="file" action="D">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/MobileApplicationSkin.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1265058 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mobiletheme/src/MobileThemeClasses.as
+++ frameworks/projects/mobiletheme/src/MobileThemeClasses.as
@@ -29,13 +29,13 @@
 import spark.skins.mobile.RadioButtonSkin; spark.skins.mobile.RadioButtonSkin;
 import spark.skins.mobile.HScrollBarSkin; spark.skins.mobile.HScrollBarSkin;
 import spark.skins.mobile.ListSkin; spark.skins.mobile.ListSkin;
-import spark.skins.mobile.MobileApplicationSkin; MobileApplicationSkin;
-import spark.skins.mobile.TabbedMobileApplicationSkin; TabbedMobileApplicationSkin;
+import spark.skins.mobile.TabbedViewNavigatorApplicationSkin; TabbedViewNavigatorApplicationSkin;
 import spark.skins.mobile.TextAreaSkin; TextAreaSkin;
 import spark.skins.mobile.TextInputSkin; TextInputSkin;
 import spark.skins.mobile.SkinnableContainerSkin; SkinnableContainerSkin;
 import spark.skins.mobile.ViewMenuItemSkin; ViewMenuItemSkin;
 import spark.skins.mobile.ViewMenuSkin; ViewMenuSkin;
+import spark.skins.mobile.ViewNavigatorApplicationSkin; ViewNavigatorApplicationSkin;
 import spark.skins.mobile.ViewNavigatorSkin; ViewNavigatorSkin;
 import spark.skins.mobile.TabbedViewNavigatorSkin; TabbedViewNavigatorSkin;
 import spark.skins.mobile.VScrollBarSkin; spark.skins.mobile.VScrollBarSkin;


Transferred from the Adobe Open Source Subversion Repository

Revision: 23247
Author:   cframpto@adobe.com
Date:     2011-12-20T19:21:13.134833Z

Log Message:
-----------
Remove ADOBE SYSTEMS license and replace with Apache license in headers - frameworks.  A 2nd pass will be needed to get the files not handled up by the scripts.

Modified Paths:
--------------
4959 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1274579 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/rpc/src/mx/rpc/xml/SchemaDatatypes.as
+++ frameworks/projects/rpc/src/mx/rpc/xml/SchemaDatatypes.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2006-2007 Adobe Systems Incorporated
-//  All Rights Reserved.
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
 //
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////