Transferred from the Adobe Open Source Subversion Repository

Revision: 16334
Author:   clucier@adobe.com
Date:     2010-05-27T02:31:28.322720Z

Log Message:
-----------
Preliminary Spark Image and BitmapImage enhancement feature work.  Also included with this checkin is the ability for BitmapImage and s:Image instances to share an image cache.  Queueing is next up to be checked in.

QE notes: Proceed with testing, though PARB related renames are pending. Not considered code complete.
Doc notes: Should begin reviewing new classes in preparation for doc'ing.
Bugs: None
Reviewer: Ryan
Tests run: Checkin, cyclone server Mustella tests.
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/core/contentLoader/ContentRequest.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/SparkClasses.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/utils/LinkedList.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/defaults.css</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/ImageLoadingSkin.mxml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/core/contentLoader/ContentCache.as</path>
<path kind="dir" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/core/contentLoader</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/ImageSkin.mxml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Image.png</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/utils/LinkedListNode.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/BitmapSmoothingQuality.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/spark-manifest.xml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/core/contentLoader/LoaderInvalidationEvent.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/core/contentLoader/IContentLoader.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/mx-manifest.xml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Image.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/FrameworkClasses.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/manifest.xml</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/BitmapScaleMode.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/BitmapImage.as</path>

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

--- frameworks/projects/spark/src/spark/primitives/BitmapImage.as
+++ frameworks/projects/spark/src/spark/primitives/BitmapImage.as
@@ -1,7 +1,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
 //  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2008 Adobe Systems Incorporated
+//  Copyright 2010 Adobe Systems Incorporated
 //  All Rights Reserved.
 //
 //  NOTICE: Adobe permits you to use, modify, and distribute this file
@@ -11,40 +11,136 @@

 package spark.primitives
 {
+
 import flash.display.Bitmap;
 import flash.display.BitmapData;
 import flash.display.DisplayObject;
+import flash.display.DisplayObjectContainer;
 import flash.display.Graphics;
+import flash.display.Loader;
+import flash.display.LoaderInfo;
 import flash.display.Sprite;
+import flash.events.Event;
+import flash.events.HTTPStatusEvent;
+import flash.events.IOErrorEvent;
+import flash.events.ProgressEvent;
+import flash.events.SecurityErrorEvent;
 import flash.geom.Matrix;
 import flash.geom.Point;
 import flash.geom.Rectangle;
-
+import flash.net.URLRequest;
+import flash.system.ApplicationDomain;
+import flash.system.LoaderContext;
+
+import mx.core.mx_internal;
 import mx.graphics.BitmapFillMode;
-
-import spark.primitives.supportClasses.GraphicElement;
+import mx.graphics.BitmapScaleMode;
+import mx.graphics.BitmapSmoothingQuality;
+
+import spark.core.contentLoader.ContentRequest;
+import spark.core.contentLoader.IContentLoader;
+import spark.core.DisplayObjectSharingMode;
+import spark.layouts.HorizontalAlign;
+import spark.layouts.VerticalAlign;
+import spark.primitives.supportClasses.GraphicElement;
+
+use namespace mx_internal;
+
+//--------------------------------------
+//  Events
+//--------------------------------------
+
+/**
+ *  Dispatched when content loading is complete.
+ *
+ *  @eventType flash.events.Event.COMPLETE
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 2.0
+ *  @productversion Flex 4.5
+ */
+[Event(name="complete", type="flash.events.Event")]
+
+/**
+ *  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
+ *  @productversion Flex 4.5
+ */
+[Event(name="httpStatus", type="flash.events.HTTPStatusEvent")]
+
+/**
+ *  Dispatched when an input/output error occurs.
+ *  @see flash.events.IOErrorEvent
+ *
+ *  @eventType flash.events.IOErrorEvent.IO_ERROR
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 2.0
+ *  @productversion Flex 4.5
+ */
+[Event(name="ioError", type="flash.events.IOErrorEvent")]
+
+/**
+ *  Dispatched when content is loading.
+ *
+ *
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
+ *  @productversion Flex 4.5
+ */
+[Event(name="progress", type="flash.events.ProgressEvent")]
+
+/**
+ *  Dispatched when a security error occurs.
+ *  @see flash.events.SecurityErrorEvent
+ *
+ *  @eventType flash.events.SecurityErrorEvent.SECURITY_ERROR
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 2.0
+ *  @productversion Flex 4.5
+ */
+[Event(name="securityError", type="flash.events.SecurityErrorEvent")]

 /**
  *  A BitmapImage element defines a rectangular region in its parent element's
- *  coordinate space, filled with bitmap data drawn from a source file.
+ *  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 1.5
- *  @productversion Flex 4
+ *  @playerversion AIR 2.0
+ *  @productversion Flex 4.0
  */
 public class BitmapImage extends GraphicElement
 {
     include "../core/Version.as";
-
+
     //--------------------------------------------------------------------------
     //
     //  Constructor
     //
     //--------------------------------------------------------------------------
-
+
     /**
      *  Constructor.
      *
@@ -68,24 +164,140 @@
     //--------------------------------------------------------------------------

     private var _bitmapData:BitmapData;
-
     private var _scaleGridBottom:Number;
     private var _scaleGridLeft:Number;
     private var _scaleGridRight:Number;
     private var _scaleGridTop:Number;
-    private var bitmapDataCreated:Boolean = false;
-
+    private var bitmapDataCreated:Boolean;
     private static var matrix:Matrix = new Matrix();
     private var cachedSourceGrid:Array;
     private var cachedDestGrid:Array;
-
+    private var imageWidth:int;
+    private var imageHeight:int;
+    private var loadedContent:DisplayObject;
     private var previousUnscaledWidth:Number;
     private var previousUnscaledHeight:Number;
-
+    private var sourceInvalid:Boolean;
+
+
+    //----------------------------------
+    //  bytesLoaded
+    //----------------------------------
+
+    private var _bytesLoaded:Number = NaN;
+
+    /**
+     *  The number of bytes of the image already loaded.
+     *  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;
+    }
+
+    //----------------------------------
+    //  bytesTotal
+    //----------------------------------
+
+    private var _bytesTotal:Number = NaN;
+
+    /**
+     *  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;
+    }
+
+	//----------------------------------
+	//  contentGrouping
+	//----------------------------------
+
+	private var _contentGrouping:String;
+
+	/**
+	 *  Optional content grouping identifier to pass to the an
+	 *  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 contentGrouping():String
+	{
+		return _contentGrouping;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set contentGrouping(value:String):void
+	{
+		if (value != _contentGrouping)
+		{
+			_contentGrouping = value;
+			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;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set contentLoader(value:IContentLoader):void
+	{
+		if (value != _contentLoader)
+		{
+			_contentLoader = value;
+			contentLoaderInvalid = true;
+			invalidateProperties();
+		}
+	}
+
     //----------------------------------
     //  fillMode
     //----------------------------------
-
+
     /**
      *  @private
      */
@@ -130,175 +342,427 @@
             invalidateDisplayList();
         }
     }
-
-    //----------------------------------
-    //  source
-    //----------------------------------
-
-    private var _source:Object;
-
-    [Inspectable(category="General")]
-
-    /**
-     *  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 instantiates
-     *       the class and creates a bitmap rendering of it.

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

-     *

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

-     *
-     *
To specify an image as a source, you must use the @Embed directive, as the following example shows:
-     *

-     *  source="@Embed('image_location')"
-     *

-     *

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

+
+    //----------------------------------
+    //  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
+     *  BitmapScaleMode.LETTERBOX.
      *
-     *
If the source is a Bitmap or BitmapData instance, it
-     *  is the responsibility of the caller to dispose of the source once it is no longer needed.
-     *  If BitmapImage 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
-     *
+     *
Can be one of HorizontalAlign.LEFT ("left"),
+     *  HorizontalAlign.RIGHT ("left"), 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
      *  @productversion Flex 4
      */
-    public function get source():Object
-    {
-        return _source;
-    }
-
-    /**
-     *  @private
-     */
-    public function set source(value:Object):void
-    {
-        if (value != _source)
-        {
-            _source = value;
-            var bitmapData:BitmapData;
-            var tmpSprite:DisplayObject;
-
-            // Clear the previous scaleGrid properties
-            _scaleGridLeft = NaN;
-            _scaleGridRight = NaN;
-            _scaleGridTop = NaN;
-            _scaleGridBottom = NaN;
-            var currentBitmapCreated:Boolean = false;
-
-            if (value is Class)
-            {
-                var cls:Class = Class(value);
-                value = new cls();
-                currentBitmapCreated = true;
-            }
-
-            if (value is BitmapData)
-            {
-                bitmapData = value as BitmapData;
-            }
-            else if (value is Bitmap)
-            {
-                bitmapData = value.bitmapData;
-            }
-            else if (value is DisplayObject)
-            {
-                tmpSprite = value as DisplayObject;
-            }
-            else if (value == null)
-            {
-                // This will set source to null
-            }
-            else
-            {
-                return;
-            }
-
-            if (!bitmapData && tmpSprite)
-            {
-                bitmapData = new BitmapData(tmpSprite.width, tmpSprite.height, true, 0);
-                bitmapData.draw(tmpSprite, new Matrix());
-                currentBitmapCreated = true;
-
-                if (tmpSprite.scale9Grid)
-                {
-                    _scaleGridLeft = tmpSprite.scale9Grid.left;
-                    _scaleGridRight = tmpSprite.scale9Grid.right;
-                    _scaleGridTop = tmpSprite.scale9Grid.top;
-                    _scaleGridBottom = tmpSprite.scale9Grid.bottom;
-                }
-            }
-
-            setBitmapData(bitmapData, currentBitmapCreated);
-        }
-    }
-
-    //----------------------------------
-    //  smooth
-    //----------------------------------
-
-    private var _smooth:Boolean = false;
-
-    [Inspectable(category="General", enumeration="true,false")]
-
-    /**
-     *  @copy flash.display.GraphicsBitmapFill#smooth
+    public function get horizontalAlign():String
+    {
+        return _horizontalAlign;
+    }
+
+    /**
+     *  @private
+     */
+    public function set horizontalAlign(value:String):void
+    {
+        if (value == _horizontalAlign)
+            return;
+
+        _horizontalAlign = value;
+        invalidateDisplayList();
+    }
+
+    /**
+     *  @private
+     */
+    private function getHorizontalAlignValue():Number
+    {
+        if (_horizontalAlign == HorizontalAlign.LEFT)
+            return 0;
+        else if (_horizontalAlign == HorizontalAlign.RIGHT)
+            return 1;
+        else
+            return 0.5;
+    }
+
+	//----------------------------------
+	//  preliminaryHeight
+	//----------------------------------
+
+	/**
+	 *  @private
+	 */
+	private var _preliminaryHeight:Number = 0;
+
+	/**
+	 *  Provides an estimate to use for height when the "measured" bounds
+	 *  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;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set preliminaryHeight(value:Number):void
+	{
+		if (value != _preliminaryHeight)
+		{
+			_preliminaryHeight = value;
+			invalidateSize();
+		}
+	}
+
+	//----------------------------------
+	//  preliminaryWidth
+	//----------------------------------
+
+	/**
+	 *  @private
+	 */
+	private var _preliminaryWidth:Number = 0;
+
+	/**
+	 *  Provides an estimate to use for width when the "measured" bounds
+	 *  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;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set preliminaryWidth(value:Number):void
+	{
+		if (value != _preliminaryWidth)
+		{
+			_preliminaryWidth = value;
+			invalidateSize();
+		}
+	}
+
+    //----------------------------------
+    //  scaleMode
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    private var _scaleMode:String = BitmapScaleMode.STRETCH;
+
+    [Inspectable(category="General", enumeration="stretch,letterbox", 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.

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

+     *
+     *  @default BitmapScaleMode.STRETCH
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.1
+     *  @playerversion AIR 2.0
+     *  @productversion Flex 4.5
+     */
+    public function get scaleMode():String
+    {
+        return _scaleMode;
+    }
+
+    /**
+     *  @private
+     */
+    public function set scaleMode(value:String):void
+    {
+        if (value == _scaleMode)
+            return;
+
+        _scaleMode = value;
+        invalidateDisplayList();
+    }
+
+    //----------------------------------
+    //  source
+    //----------------------------------
+
+    private var _source:Object;
+
+    [Inspectable(category="General")]
+
+    /**
+     *  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
+     *       instantiates the class and creates a bitmap rendering of it.

+     *
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,
+     *  or JPG.

+     *
+     *
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 a URL 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
+     *  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
+     *  changed.

+     *
+     *  @see flash.display.Bitmap
+     *  @see flash.display.BitmapData
+     *  @see mx.graphics.BitmapFill
      *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
-    public function set smooth(value:Boolean):void
-    {
-        if (value != _smooth)
-        {
-            _smooth = value;
-            invalidateDisplayList();
-        }
-    }
-
-    /**
-     *  @private
-     */
-    public function get  smooth():Boolean
-    {
-        return _smooth;
-    }
-
-    //--------------------------------------------------------------------------
-    //
-    //  overridden methods from GraphicElement
-    //
-    //--------------------------------------------------------------------------
-
-    /**
-     *  @inheritDoc
+    public function get source():Object
+    {
+        return _source;
+    }
+
+    /**
+     *  @private
+     */
+    public function set source(value:Object):void
+    {
+        if (value != _source)
+        {
+            _source = value;
+            sourceInvalid = true;
+            invalidateProperties();
+        }
+    }
+
+    //----------------------------------
+    //  smooth
+    //----------------------------------
+
+    private var _smooth:Boolean = 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
      *  @productversion Flex 4
      */
-    override protected function measure():void
-    {
-        measuredWidth = _bitmapData ? _bitmapData.width : 0;
-        measuredHeight = _bitmapData ? _bitmapData.height : 0;
-    }
-
+    public function set smooth(value:Boolean):void
+    {
+        if (value != _smooth)
+        {
+            _smooth = value;
+            invalidateDisplayList();
+        }
+    }
+
+    /**
+     *  @private
+     */
+    public function get smooth():Boolean
+    {
+        return _smooth;
+    }
+
+    //----------------------------------
+    //  smoothingQuality
+    //----------------------------------
+
+    private var _smoothingQuality:String = BitmapSmoothingQuality.DEFAULT;
+
+    [Inspectable(category="General", enumeration="default,high", defaultValue="default")]
+
+    /**
+     *  Determines how the image is down-scaled.  When set to
+     *  BitmapSmoothingQuality.BEST, 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
+     *  quality for scaled bitmap fills is used.
+     *
+     *  @default BitmapSmoothingQuality.DEFAULT
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4.5
+     */
+    public function set smoothingQuality(value:String):void
+    {
+        if (value != _smoothingQuality)
+        {
+            _smoothingQuality = value;
+            invalidateDisplayList();
+        }
+    }
+
+    /**
+     *  @private
+     */
+    public function get smoothingQuality():String
+    {
+        return _smoothingQuality;
+    }
+
+    //----------------------------------
+    //  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,
+     *  tiling, etc. are not permitted.  This flag is set once an
+     *  image has been fully loaded.
+     *
+     *  @default true
+     *
+     *  @langversion 4.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4.5
+     */
+	public function get trustedSource():Boolean
+	{
+		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
+     *  BitmapScaleMode.LETTERBOX.
+     *
+     *
Can be one of VerticalAlign.TOP ("left"),
+     *  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
+     *  @productversion Flex 4.5
+     */
+    public function get verticalAlign():String
+    {
+        return _verticalAlign;
+    }
+
+    /**
+     *  @private
+     */
+    public function set verticalAlign(value:String):void
+    {
+        if (value == _verticalAlign)
+            return;
+
+        _verticalAlign = value;
+        invalidateDisplayList();
+    }
+
+    /**
+     *  @private
+     */
+    private function getVerticalAlignValue():Number
+    {
+        if (_verticalAlign == VerticalAlign.TOP)
+            return 0;
+        else if (_verticalAlign == VerticalAlign.BOTTOM)
+            return 1;
+        else
+            return 0.5;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  GraphicElement Overrides
+    //
+    //--------------------------------------------------------------------------
+
     /**
      *  @inheritDoc
      *
@@ -307,12 +771,137 @@
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
+    override protected function commitProperties():void
+    {
+        if (sourceInvalid || contentLoaderInvalid)
+            applySource();
+
+		sourceInvalid = false;
+		contentLoaderInvalid = false;
+
+        super.commitProperties();
+    }
+
+    /**
+     *  @inheritDoc
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    override protected function measure():void
+    {
+        if (loadedContent)
+        {
+            // Return size of our loaded image content.
+            measuredWidth = imageWidth;
+            measuredHeight = imageHeight;
+        }
+        else if (_bitmapData)
+        {
+            // Return size of our bitmap data.
+            measuredWidth = _bitmapData.width;
+            measuredHeight = _bitmapData.height;
+        }
+        else
+        {
+            // Return estimated width/height here as we've yet to fully
+            // realize valid image content.
+            measuredWidth = _preliminaryWidth;
+            measuredHeight = _preliminaryHeight;
+            return;
+        }
+
+        // Consider aspectRatio
+        if (maintainAspectRatio && measuredWidth > 0 && measuredHeight > 0)
+        {
+            if(!isNaN(explicitWidth) && isNaN(explicitHeight) &&
+                isNaN(percentHeight))
+            {
+                measuredHeight = explicitWidth/measuredWidth * measuredHeight;
+            }
+            else if (!isNaN(explicitHeight) && isNaN(explicitWidth) &&
+                isNaN(percentWidth))
+            {
+                measuredWidth = explicitHeight/measuredHeight * measuredWidth;
+            }
+            else if (!isNaN(percentWidth) && isNaN(explicitHeight) &&
+                isNaN(percentHeight) && width > 0)
+            {
+                measuredHeight = width/measuredWidth * measuredHeight;
+            }
+            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,
                                                   unscaledHeight:Number):void
     {
+        var adjustedHeight:Number = unscaledHeight;
+        var adjustedWidth:Number = unscaledWidth;
+
+        // Consider aspectRatio
+        if (maintainAspectRatio)
+        {
+            var aspectRatio:Number = unscaledWidth/unscaledHeight;
+            var imageAspectRatio:Number = imageWidth/imageHeight;
+            if (!isNaN(imageAspectRatio))
+            {
+                if (imageAspectRatio > aspectRatio)
+                    adjustedHeight = unscaledWidth / imageAspectRatio;
+                else
+                    adjustedWidth = unscaledHeight * imageAspectRatio;
+
+                if ((!isNaN(percentWidth) && isNaN(percentHeight) && isNaN(explicitHeight)) ||
+                    (!isNaN(percentHeight) && isNaN(percentWidth) && isNaN(explicitWidth)))
+                {
+                    if (aspectRatio != imageAspectRatio)
+                    {
+                        invalidateSize();
+                        return;
+                    }
+                }
+            }
+        }
+
         if (!_bitmapData || !drawnDisplayObject || !(drawnDisplayObject is Sprite))
+        {
+            if (loadedContent)
+            {
+                loadedContent.width = adjustedWidth;
+                loadedContent.height = adjustedHeight;
+                loadedContent.y = 0;
+                loadedContent.x = 0;
+
+                // Adjust our loaded content as necessary to requested alignment
+                // if we are maintaining aspect ratio and we have left over space.
+                if (maintainAspectRatio)
+                {
+                    if (unscaledHeight > adjustedHeight)
+                        loadedContent.y = Math.floor((unscaledHeight - adjustedHeight)
+                            * getVerticalAlignValue());
+
+                    if (unscaledWidth > adjustedWidth)
+                        loadedContent.x = Math.floor((unscaledWidth - adjustedWidth)
+                            * getHorizontalAlignValue());
+                }
+            }
             return;
-
+        }
+
         // The base GraphicElement class has cleared the graphics for us.
         var g:Graphics = Sprite(drawnDisplayObject).graphics;

@@ -322,9 +911,9 @@
         var fillScaleY:Number = 1;
         var roundedDrawX:Number = Math.round(drawX);
         var roundedDrawY:Number = Math.round(drawY);
-        var fillWidth:Number = unscaledWidth;
-        var fillHeight:Number = unscaledHeight;
-
+        var fillWidth:Number = adjustedWidth;
+        var fillHeight:Number = adjustedHeight;
+
         switch(_fillMode)
         {
             case BitmapFillMode.REPEAT:
@@ -332,44 +921,69 @@
                 {
                     repeatBitmap = true;
                 }
-            break;
-
+                break;
+
             case BitmapFillMode.SCALE:
                 if (_bitmapData)
                 {
-                    fillScaleX = unscaledWidth / _bitmapData.width;
-                    fillScaleY = unscaledHeight / _bitmapData.height;
+                    fillScaleX = adjustedWidth / _bitmapData.width;
+                    fillScaleY = adjustedHeight / _bitmapData.height;
                 }
-            break;
+                break;

             case BitmapFillMode.CLIP:
                 if (_bitmapData)
                 {
-                    fillWidth = Math.min(unscaledWidth, _bitmapData.width);
-                    fillHeight = Math.min(unscaledHeight, _bitmapData.height);
+                    fillWidth = Math.min(adjustedWidth, _bitmapData.width);
+                    fillHeight = Math.min(adjustedHeight, _bitmapData.height);
                 }
-            break;
-        }
-
-        // If no scaleGrid is defined or if fillMode != SCALE, just draw the entire rect
+                break;
+        }
+
+        // If no scaleGrid is defined or if fillMode != SCALE, just draw
+        // the entire rect
         if (_fillMode != BitmapFillMode.SCALE ||
             isNaN(_scaleGridTop) ||
             isNaN(_scaleGridBottom) ||
             isNaN(_scaleGridLeft) ||
             isNaN(_scaleGridRight))
         {
-
+            var sampledScale:Boolean = _smooth && _smoothingQuality == BitmapSmoothingQuality.HIGH;
+            var b:BitmapData = sampledScale ? resample(_bitmapData, fillWidth, fillHeight) : _bitmapData;
+
+            if (sampledScale && _fillMode == BitmapFillMode.SCALE)
+            {
+                fillScaleX = adjustedWidth / b.width;
+                fillScaleY = adjustedHeight / b.height;
+            }
+
+            var offsetX:Number = 0;
+            var offsetY:Number = 0;
+
+            if (maintainAspectRatio)
+            {
+                var cHeight:Number = b.height * fillScaleX;
+                var cWidth:Number = b.width * fillScaleY;
+
+                if (unscaledHeight > cHeight)
+                    roundedDrawY = roundedDrawY + Math.floor((unscaledHeight - cHeight)
+                        * getVerticalAlignValue());
+
+                if (unscaledWidth > cWidth)
+                    roundedDrawX = roundedDrawX + Math.floor((unscaledWidth - cWidth)
+                        * getHorizontalAlignValue());
+            }

             matrix.identity();
-            matrix.scale(fillScaleX, fillScaleY);
-            matrix.translate(roundedDrawX, roundedDrawY);
-            g.beginBitmapFill(_bitmapData, matrix, repeatBitmap, smooth);
+            if (!(sampledScale && maintainAspectRatio))
+                matrix.scale(fillScaleX, fillScaleY);
+            matrix.translate(roundedDrawX, roundedDrawY);
+            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
             // on the grid region.

@@ -378,13 +992,13 @@
                 // Generate the 16 points of the source (unscaled) grid
                 cachedSourceGrid = [];
                 cachedSourceGrid.push([new Point(0, 0), new Point(_scaleGridLeft, 0),
-                                new Point(_scaleGridRight, 0), new Point(_bitmapData.width, 0)]);
+                    new Point(_scaleGridRight, 0), new Point(_bitmapData.width, 0)]);
                 cachedSourceGrid.push([new Point(0, _scaleGridTop), new Point(_scaleGridLeft, _scaleGridTop),
-                                new Point(_scaleGridRight, _scaleGridTop), new Point(_bitmapData.width, _scaleGridTop)]);
+                    new Point(_scaleGridRight, _scaleGridTop), new Point(_bitmapData.width, _scaleGridTop)]);
                 cachedSourceGrid.push([new Point(0, _scaleGridBottom), new Point(_scaleGridLeft, _scaleGridBottom),
-                                new Point(_scaleGridRight, _scaleGridBottom), new Point(_bitmapData.width, _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)]);
+                    new Point(_scaleGridRight, _bitmapData.height), new Point(_bitmapData.width, _bitmapData.height)]);
             }

             if (cachedDestGrid == null ||
@@ -396,15 +1010,15 @@
                 var destScaleGridRight:Number = unscaledWidth - (_bitmapData.width - _scaleGridRight);
                 cachedDestGrid = [];
                 cachedDestGrid.push([new Point(0, 0), new Point(_scaleGridLeft, 0),
-                                new Point(destScaleGridRight, 0), new Point(unscaledWidth, 0)]);
+                    new Point(destScaleGridRight, 0), new Point(unscaledWidth, 0)]);
                 cachedDestGrid.push([new Point(0, _scaleGridTop), new Point(_scaleGridLeft, _scaleGridTop),
-                                new Point(destScaleGridRight, _scaleGridTop), new Point(unscaledWidth, _scaleGridTop)]);
+                    new Point(destScaleGridRight, _scaleGridTop), new Point(unscaledWidth, _scaleGridTop)]);
                 cachedDestGrid.push([new Point(0, destScaleGridBottom), new Point(_scaleGridLeft, destScaleGridBottom),
-                                new Point(destScaleGridRight, destScaleGridBottom), new Point(unscaledWidth, 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)]);
+                    new Point(destScaleGridRight, unscaledHeight), new Point(unscaledWidth, unscaledHeight)]);
             }
-
+
             var sourceSection:Rectangle = new Rectangle();
             var destSection:Rectangle = new Rectangle();

@@ -433,40 +1047,379 @@
                     g.beginBitmapFill(_bitmapData, matrix);
                     g.drawRect(destSection.x + roundedDrawX, destSection.y + roundedDrawY, destSection.width, destSection.height);
                     g.endFill();
-                 }
+                }
             }
         }

         previousUnscaledWidth = unscaledWidth;
         previousUnscaledHeight = unscaledHeight;
-    }
-
+    }
+
+    /**
+     *  @private
+     */
+    override protected function get needsDisplayObject():Boolean
+    {
+        // 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.
      */
-    private function setBitmapData(bitmapData:BitmapData, internallyCreated:Boolean = false):void
+    protected function setBitmapData(bitmapData:BitmapData,
+                                     internallyCreated:Boolean = false):void
     {
         // Clear previous bitmapData
         if (_bitmapData)
         {
-            if (bitmapDataCreated) // Dispose the bitmap if we created it
+            // Dispose the bitmap if we created it
+            if (bitmapDataCreated)
                 _bitmapData.dispose();
             _bitmapData = null;
         }

-        bitmapDataCreated = internallyCreated;
-
-        _bitmapData = bitmapData;
-
-        // Flush the cached scale grid points
-        cachedSourceGrid = null;
-        cachedDestGrid = null;
-
+        if (bitmapData)
+        {
+            bitmapDataCreated = internallyCreated;
+
+            _bitmapData = bitmapData;
+
+            imageWidth = bitmapData.width;
+            imageHeight = bitmapData.height;
+
+            // Flush the cached scale grid points
+            cachedSourceGrid = null;
+            cachedDestGrid = null;
+        }
+
         invalidateSize();
         invalidateDisplayList();
     }
+
+    /**
+     *  @private
+     *  Utility method which analyzes our source and either acquires the
+     *  associated bitmap data immediately or queues up a remote request
+     *  as necessary.
+     */
+    mx_internal function applySource():void
+    {
+        var value:Object = _source;
+        var bitmapData:BitmapData;
+        var tmpSprite:DisplayObject;
+
+        // Clear the previous scaleGrid properties
+        _scaleGridLeft = NaN;
+        _scaleGridRight = NaN;
+        _scaleGridTop = NaN;
+        _scaleGridBottom = NaN;
+        var currentBitmapCreated:Boolean = false;
+
+		// Clear any previously loaded content.
+		loadedContent = null;
+
+		// Reset byte counts and _trustedSource
+		_bytesLoaded = NaN;
+		_bytesTotal = NaN;
+		_trustedSource = true;
+
+		// We'll need to reconsider display object sharing.
+		invalidateDisplayObjectSharing();
+
+        if (value is Class)
+        {
+            var cls:Class = Class(value);
+            value = new cls();
+            currentBitmapCreated = true;
+        }
+        else if (value is String)
+        {
+            loadExternal(value as String);
+        }
+
+        if (value is BitmapData)
+        {
+            bitmapData = value as BitmapData;
+        }
+        else if (value is Bitmap)
+        {
+            bitmapData = value.bitmapData;
+        }
+        else if (value is DisplayObject)
+        {
+            tmpSprite = value as DisplayObject;
+        }
+        else if (value == null)
+        {
+            // This will set source to null
+        }
+        else
+        {
+            return;
+        }
+
+        if (!bitmapData && tmpSprite)
+        {
+            bitmapData = new BitmapData(tmpSprite.width, tmpSprite.height, true, 0);
+            bitmapData.draw(tmpSprite, new Matrix());
+            currentBitmapCreated = true;
+
+            if (tmpSprite.scale9Grid)
+            {
+                _scaleGridLeft = tmpSprite.scale9Grid.left;
+                _scaleGridRight = tmpSprite.scale9Grid.right;
+                _scaleGridTop = tmpSprite.scale9Grid.top;
+                _scaleGridBottom = tmpSprite.scale9Grid.bottom;
+            }
+        }
+
+        setBitmapData(bitmapData, currentBitmapCreated);
+    }
+
+    /**
+     *  @private
+     */
+    mx_internal function loadExternal(url:String):void
+    {
+        var loaderInfo:Object;
+
+        if (contentLoader)
+        {
+            // We defer our load request to the configured content loader.
+            var contentRequest:ContentRequest = contentLoader.load(url, contentGrouping);
+
+            if (contentRequest.complete)
+            {
+                // No need to attach listeners as we've received a fully complete
+                // request result.
+                contentComplete(contentRequest.content);
+            }
+            else
+            {
+                contentRequest.addEventListener(Event.COMPLETE,
+                    loader_completeHandler, false, 0, true);
+                contentRequest.addEventListener(IOErrorEvent.IO_ERROR,
+                    loader_ioErrorHandler, false, 0, true);
+                contentRequest.addEventListener(ProgressEvent.PROGRESS,
+                    loader_progressHandler, false, 0, true);
+                contentRequest.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
+                    loader_securityErrorHandler, false, 0, true);
+            }
+        }
+        else
+        {
+            var loader:Loader = new Loader();
+
+            var loaderContext:LoaderContext = new LoaderContext();
+            loaderContext.checkPolicyFile = true;
+
+            loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
+                loader_completeHandler, false, 0, true);
+            loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,
+                loader_ioErrorHandler, false, 0, true);
+            loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
+                loader_progressHandler, false, 0, true);
+            loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
+                loader_securityErrorHandler, false, 0, true);
+            try
+            {
+                loader.load(new URLRequest(url), loaderContext);
+                dispatchEvent(new ProgressEvent(ProgressEvent.PROGRESS));
+            }
+            catch (error:SecurityError)
+            {
+                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,
+                                       newHeight:uint):BitmapData
+    {
+        var finalScale:Number = Math.min(newWidth/bitmapData.width,
+            newHeight/bitmapData.height);
+        var finalData:BitmapData = bitmapData;
+
+        if (finalScale > 1)
+        {
+            finalData = new BitmapData(bitmapData.width * finalScale,
+                bitmapData.height * finalScale, true, 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)
+            initialScale /= drop;
+
+        var bd:BitmapData = new BitmapData(Math.ceil(bitmapData.width *
+            initialScale), Math.ceil(bitmapData.height * 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)
+        {
+            bd = new BitmapData(Math.ceil(bitmapData.width * scale),
+                Math.ceil(bitmapData.height * scale));
+            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.
+     */
+    protected function contentComplete(loaderInfo:LoaderInfo):void
+    {
+        if (loaderInfo.childAllowsParent)
+        {
+            // For trusted content we adopt the loaded BitmapData.
+            var image:Bitmap = Bitmap(loaderInfo.content);
+            setBitmapData(image.bitmapData);
+        }
+        else
+        {
+			// Clear any previous bitmap data.
+			setBitmapData(null);
+
+            // For untrusted content we must host the acquired Loader
+            // 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);
+			loadedContent = loaderInfo.loader;
+            contentHolder.addChild(loadedContent);
+
+			// Retain our source image width and height.
+            imageWidth = loaderInfo.width;
+            imageHeight = loaderInfo.height ;
+
+			// Update
+			invalidateSize();
+            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;
+        }
+    }
+
+    /**
+     * @private
+     * Returns true if are to consider aspect ratio while scaling.
+     */
+    protected function get maintainAspectRatio():Boolean
+    {
+        return (_scaleMode == BitmapScaleMode.LETTERBOX && _fillMode == BitmapFillMode.SCALE);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Event handlers
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+	mx_internal function loader_completeHandler(event:Event):void
+    {
+        try
+        {
+            var loaderInfo:LoaderInfo = (event.target is ContentRequest) ?
+                event.target.content as LoaderInfo : event.target as LoaderInfo;
+
+            if (loaderInfo.bytesLoaded)
+            {
+                _bytesLoaded = _bytesTotal;
+                contentComplete(loaderInfo);
+            }
+        }
+        catch (error:SecurityError)
+        {
+            handleSecurityError(error);
+        }
+
+		dispatchEvent(event);
+    }
+
+    /**
+     *  @private
+     */
+	private function loader_ioErrorHandler(error:IOErrorEvent):void
+    {
+        // clear any current image
+        setBitmapData(null);
+
+		// forward the event, only in the case of a listener, else
+		// an RTE will occur.
+		if (hasEventListener(error.type))
+			dispatchEvent(error);
+    }
+
+    /**
+     *  @private
+     */
+	private function loader_securityErrorHandler(error:SecurityErrorEvent):void
+    {
+        // clear any current image and forward the error.
+        setBitmapData(null);
+        dispatchEvent(error);
+    }
+
+    /**
+     *  @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
+    {
+        setBitmapData(null);
+        dispatchEvent(new SecurityErrorEvent(SecurityErrorEvent.SECURITY_ERROR,
+            false, false, error.message));
+    }
+}
 }
-
-}


Remove PhysicsWorld from default scene components. Don't allow remove MaterialCache2D and DrawableProxy2D in scene.

--- Bin/Data/Scripts/Editor/EditorScene.as
+++ Bin/Data/Scripts/Editor/EditorScene.as
@@ -86,7 +86,6 @@
     // Create a scene with default values, these will be overridden when loading scenes
     editorScene.Clear();
     editorScene.CreateComponent("Octree");
-    editorScene.CreateComponent("PhysicsWorld");
     editorScene.CreateComponent("DebugRenderer");

     // Release resources that became unused after the scene clear
@@ -486,9 +485,9 @@
         if (index == NO_ITEM || nodeIndex == NO_ITEM)
             continue;

-        // Do not allow to remove the Octree, PhysicsWorld or DebugRenderer from the root node
-        if (node is editorScene && (component.typeName == "Octree" || component.typeName == "PhysicsWorld" ||
-            component.typeName == "DebugRenderer"))
+        // Do not allow to remove the Octree, DebugRenderer or MaterialCache2D or DrawableProxy2D from the root node
+        if (node is editorScene && (component.typeName == "Octree" || component.typeName == "DebugRenderer" ||
+            component.typeName == "MaterialCache2D" || component.typeName == "DrawableProxy2D"))
             continue;

         // Create undo action


Correct data type for spawn object counting variable.

--- Bin/Data/Scripts/Editor/EditorSpawn.as
+++ Bin/Data/Scripts/Editor/EditorSpawn.as
@@ -13,11 +13,11 @@
 Vector3 randomRotation = Vector3(0, 0, 0);
 float randomScaleMin = 1;
 float randomScaleMax = 1;
-float spawnCount = 1;
+uint spawnCount = 1;
 float spawnRadius = 0;
 bool useNormal = true;

-int numberSpawnedObjects = 1;
+uint numberSpawnedObjects = 1;
 Array<String> spawnedObjectsNames;

 void CreateSpawnEditor()
@@ -82,7 +82,6 @@
     spawnWindow.visible = false;
 }

-
 void PickSpawnObject()
 {
     @resourcePicker = GetResourcePicker(ShortStringHash("Node"));
@@ -96,7 +95,6 @@
     SubscribeToEvent(uiFileSelector, "FileSelected", "PickSpawnObjectDone");
 }

-
 void EditRandomRotation(StringHash eventType, VariantMap& eventData)
 {
     LineEdit@ edit = eventData["Element"].GetPtr();
@@ -112,20 +110,16 @@
     UpdateHierarchyItem(editorScene);
 }

-
-
 void ToggleUseNormal(StringHash eventType, VariantMap& eventData)
 {
     useNormal = cast<CheckBox>(eventData["Element"].GetPtr()).checked;
 }

-
-
 void UpdateNumberSpawnedObjects(StringHash eventType, VariantMap& eventData)
 {
     LineEdit@ edit = eventData["Element"].GetPtr();
-    numberSpawnedObjects = edit.text.ToFloat();
-    edit.text = String(numberSpawnedObjects);
+    numberSpawnedObjects = edit.text.ToUInt();
+    edit.text = String(numberSpawnedObjects);
     RefreshPickedObjects();
 }

@@ -134,10 +128,11 @@
     LineEdit@ edit = eventData["Element"].GetPtr();
     spawnRadius = edit.text.ToFloat();
 }
+
 void EditSpawnCount(StringHash eventType, VariantMap& eventData)
 {
     LineEdit@ edit = eventData["Element"].GetPtr();
-    spawnCount = edit.text.ToFloat();
+    spawnCount = edit.text.ToUInt();
 }

 void RefreshPickedObjects()
@@ -170,9 +165,9 @@
 {
     LineEdit@ nameEdit = eventData["Element"].GetPtr();
     int index = nameEdit.vars["Index"].GetUInt();
-    String resourceName = nameEdit.text;
-    spawnedObjectsNames[index] = VerifySpawnedObjectFile(resourceName);
-    RefreshPickedObjects();
+    String resourceName = VerifySpawnedObjectFile(nameEdit.text);
+    nameEdit.text = resourceName;
+    spawnedObjectsNames[index] = resourceName;
 }

 String VerifySpawnedObjectFile(const String&in resourceName)
@@ -298,4 +293,3 @@
         }
     }
 }
-


Added more tests for defer

Added more tests for defer

--- source/RxAsTests/src/rx/tests/operators/DeferFixture.as
+++ source/RxAsTests/src/rx/tests/operators/DeferFixture.as
@@ -38,14 +38,13 @@
 			Assert.assertEquals(1, statsB.nextCalled);
 			Assert.assertEquals(5, statsB.nextValues[0]);
 		}
-
-/*
+
 		[Test(expects="Error")]
 		public function errors_thrown_by_subscriber_are_bubbled() : void
 		{
 			var manObs : ManualObservable = new ManualObservable(int);

-			var obs : IObservable = manObs.take(3);
+			var obs : IObservable = Observable.defer(int, function():IObservable { return manObs; });

 			obs.subscribeFunc(
 				function(pl:int):void { throw new Error(); },
@@ -55,6 +54,22 @@

 			manObs.onNext(0);
 		}
-*/
+
+		[Test(expects="Error")]
+		public function errors_thrown_by_observable_factory_are_bubbled() : void
+		{
+			var manObs : ManualObservable = new ManualObservable(int);
+
+			var obs : IObservable = Observable.defer(int, function():IObservable
+			{
+				throw new Error();
+			});
+
+			obs.subscribeFunc(
+				function(pl:int):void { },
+				function():void { },
+				function(e:Error):void { Assert.fail("Unexpected call to onError"); }
+			);
+		}
 	}
 }


M Add loaded data into onComplete signal in SceneLoader

--- src/aerys/minko/type/loader/SceneLoader.as
+++ src/aerys/minko/type/loader/SceneLoader.as
@@ -178,7 +178,7 @@
 		private function onParseComplete(parser : IParser, loadedData : ISceneNode) : void
 		{
 			_data = loadedData;
-			_complete.execute(this);
+			_complete.execute(this, loadedData);
 		}
 	}
 }


ugh whitespace

ugh whitespace

--- node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/rsa/RSAKey.as
+++ node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/rsa/RSAKey.as
@@ -69,7 +69,7 @@

 		}
-
+
 		public static function parsePublicKey(N:String, E:String):RSAKey {
 			return new RSAKey(new BigInteger(N, 16, true), parseInt(E,16));
 		}
@@ -94,14 +94,14 @@
 			n = null;
 			Memory.gc();
 		}
-
+
 		public function encrypt(src:ByteArray, dst:ByteArray, length:uint, pad:Function=null):void {
 			_encrypt(doPublic, src, dst, length, pad, 0x02);
 		}
 		public function decrypt(src:ByteArray, dst:ByteArray, length:uint, pad:Function=null):void {
 			_decrypt(doPrivate2, src, dst, length, pad, 0x02);
 		}
-
+
 		public function sign(src:ByteArray, dst:ByteArray, length:uint, pad:Function = null):void {
 			_encrypt(doPrivate2, src, dst, length, pad, 0x01);
 		}
@@ -109,7 +109,7 @@
 			_decrypt(doPublic, src, dst, length, pad, 0x01);
 		}

-
+
 		private function _encrypt(op:Function, src:ByteArray, dst:ByteArray, length:uint, pad:Function, padType:int):void {
 			// adjust pad if needed
 			if (pad==null) pad = pkcs1pad;


Switched module pickup use bloc code

Switched module pickup use bloc code

--- src/LevelStates/LevelState.as
+++ src/LevelStates/LevelState.as
@@ -636,16 +636,16 @@
 			midLayer.add(displayModule);
 			displayModules.push(displayModule);

-			addBlocFromModule(displayModule);
-
+			currentBloc = addBlocFromModule(displayModule);
 		}

 		private function pickUpModule():void {
 			var mousedModule:Module = findMousedModule();
 			if (mousedModule && !mousedModule.FIXED) {
-				new CustomAction(Module.remove, Module.place, mousedModule, new Point(mousedModule.x, mousedModule.y)).execute();
-				mousedModule.exists = true;
-				addBlocFromModule(associatedDisplayModule(mousedModule));
+				currentBloc = addBlocFromModule(associatedDisplayModule(mousedModule), true);
+				new BlocLiftAction(currentBloc, U.pointToGrid(U.mouseLoc)).execute();
+				currentBloc.mobilize();
+				currentBloc.exists = true;
 			}
 		}

@@ -661,11 +661,11 @@
 				}
 		}

-		private function addBlocFromModule(displayModule:DModule):Bloc {
+		private function addBlocFromModule(displayModule:DModule, Rooted:Boolean = false):Bloc {
 			var displayModules:Vector.<DModule> = new Vector.<DModule>;
 			displayModules.push(displayModule);

-			var displayBloc:DBloc = DBloc.fromDisplays(new Vector.<DWire>, displayModules, false);
+			var displayBloc:DBloc = DBloc.fromDisplays(new Vector.<DWire>, displayModules, Rooted);
 			displayBloc.bloc.origin = U.pointToGrid(U.mouseLoc);
 			midLayer.add(displayBloc);

@@ -702,7 +702,7 @@
 			undoButton.active = canUndo();
 			redoButton.exists = reactionStack.length > 0;
 			redoButton.active = canRedo();
-			var undoAlpha:Number = currentWire || currentBloc ? 0.3 : 1;
+			var undoAlpha:Number = currentWire || (currentBloc && !currentBloc.rooted) ? 0.3 : 1;
 			undoButton.setAlpha(undoAlpha);
 			redoButton.setAlpha(undoAlpha);

@@ -1055,11 +1055,11 @@
 		}

 		private function canUndo():Boolean {
-			return actionStack.length > 0 && !currentWire && !currentBloc;
+			return actionStack.length > 0 && !currentWire && (!currentBloc || currentBloc.rooted);
 		}

 		private function canRedo():Boolean {
-			return reactionStack.length > 0 && !currentWire && !currentBloc;
+			return reactionStack.length > 0 && !currentWire && (!currentBloc || currentBloc.rooted);
 		}


Fixed end test button appearing when not testing

--- src/LevelStates/LevelState.as
+++ src/LevelStates/LevelState.as
@@ -180,7 +180,8 @@
 				upperLayer.add(displayTime = new DTime(FlxG.width / 2 - 50, 10))
 			else {
 				upperLayer.add(displayTime);
-				makeEndTestButton();
+				if (runningDisplayTest)
+					makeEndTestButton();
 			}
 		}


DataProvider.removeAllProperties() and DataProvider.invalidate() will now return this

--- src/aerys/minko/type/data/DataProvider.as
+++ src/aerys/minko/type/data/DataProvider.as
@@ -93,10 +93,12 @@
 			return this;
 		}

-		public function removeAllProperties() : void
+		public function removeAllProperties() : DataProvider
 		{
 			for (var propertyName : String in _data)
 				removeProperty(propertyName);
+
+			return this;
 		}

 		public function propertyExists(name : String) : Boolean
@@ -104,9 +106,11 @@
 			return _descriptor.hasOwnProperty(name);
 		}

-		public function invalidate() : void
+		public function invalidate() : DataProvider
 		{
 			_changed.execute(this, null);
+
+			return this;
 		}

 		public function clone() : DataProvider


Transferred from the Adobe Open Source Subversion Repository

Revision: 19316
Author:   smgilson@adobe.com
Date:     2010-12-13T19:12:21.336750Z

Log Message:
-----------
ASDoc updates

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

Modified Paths:
--------------
<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/projects/mobilecomponents/src/spark/components/supportClasses/ViewReturnObject.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewNavigatorAction.as</path>
<path kind="file" action="M">/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/supportClasses/NavigationStack.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewDescriptor.as</path>

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

--- frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewDescriptor.as
+++ frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewDescriptor.as
@@ -22,9 +22,11 @@
 /**
  *  The ViewDescriptor object is a data structure used to store information
  *  about a view that is being managed by a ViewNavigator.
+ *
+ *  @see spark.components.ViewNavigator
  *
  *  @langversion 3.0
- *  @playerversion Flash 10.1
+ *  @playerversion Flash 10
  *  @playerversion AIR 2.5
  *  @productversion Flex 4.5
  */
@@ -39,13 +41,16 @@
     /**
      *  Constructor.
      *
-     *  @param viewClass The class used to create the View
-     *  @param data The data object to pass to the view when created
-     *  @param context The context of the view
-     *  @param instance A reference to the instance of the View
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 10.1
+     *  @param viewClass The class used to create the View object.
+     *
+     *  @param data The data object to pass to the view when it is created.
+     *
+     *  @param context The context of the view.
+     *
+     *  @param instance A reference to the instance of the View object.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
      *  @playerversion AIR 2.5
      *  @productversion Flex 4.5
      */
@@ -71,9 +76,12 @@
     //----------------------------------

     /**
-     *  The string that describes the context in which this view was
-     *  created.  This property is assigned to the context
-     *  parameter that is passed into ViewNavigator.pushView().
+     *  The string that describes the context in which this view was created.
+     *  This property is assigned to the context
+     *  parameter that is passed to the
+     *  ViewNavigator.pushView() method.
+     *
+     *  @see spark.components.ViewNavigator#pushView()
      *
      *  @langversion 3.0
      *  @playerversion Flash 10
@@ -87,9 +95,12 @@
     //----------------------------------

     /**
-     *  The current data object that is being used by the view.  When a view
-     *  is removed from a navigation stack, this value will be updated to
-     *  match the view's instance's current data object.
+     *  The current data object that is being used by the view.
+     *  When a view is removed from a navigation stack, this value
+     *  is updated to match the view's instance's current
+     *  data object.
+     *
+     *  @see spark.components.View#data
      *
      *  @langversion 3.0
      *  @playerversion Flash 10
@@ -103,9 +114,9 @@
     //----------------------------------

     /**
-     *  A reference to the instance that is represented by this view object.
-     *  ViewNavigator will create and assign the instance as needed.  This
-     *  property will be nulled out when a view is destroyed.
+     *  A reference to the View instance that is represented by this object.
+     *  The ViewNavigator creates and assigns the instance as needed.
+     *  This property is set to null when a view is destroyed.
      *
      *  @langversion 3.0
      *  @playerversion Flash 10
@@ -121,8 +132,8 @@
     /**
      *  The serialized data that the view has requested be saved to disk when
      *  the application is writing data to a shared object or external file.
-     *  This object is the result of the serializeData() method
-     *  on View.
+     *  This object is the result of calling
+     *  the serializeData() method on the View object.
      *
      *  @langversion 3.0
      *  @playerversion Flash 10
@@ -136,8 +147,10 @@
     //----------------------------------

     /**
-     *  The class used to create the view.  ViewNavigator will expect this
-     *  class to subclass View.
+     *  The class used to create the view.
+     *  The ViewNavigator expects this class to be a subclass of View.
+     *
+     *  @see spark.components.View
      *
      *  @langversion 3.0
      *  @playerversion Flash 10


Transferred from the Adobe Open Source Subversion Repository

Revision: 11449
Author:   rfrishbe@adobe.com
Date:     2009-11-05T01:09:57.699854Z

Log Message:
-----------
Adding OSMF to our framework.  The osmf.swc builds automatically as part of our build process.  I'm also adding new video classes that use OSMF, spark.components.VideoDisplay and spark.components.VideoPlayer2.  The other VideoElement and VideoPlayer will be replaced by these.  The new video components are not yet complete; this is an initial checkin for these components.

QE notes: -
Doc notes: -
Bugs: -
Reviewer: Deepa (only the build processes stuff)
Tests run: checkintests
Is noteworthy for integration: Yes

Modified Paths:
--------------
283 paths were modified

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

--- frameworks/projects/spark/src/spark/components/mediaClasses/DynamicStreamingVideoSource.as
+++ frameworks/projects/spark/src/spark/components/mediaClasses/DynamicStreamingVideoSource.as
@@ -15,22 +15,22 @@
 [DefaultProperty("streamItems")]

 /**
- *  The StreamingVideoSource class represents a streaming video source and can be
+ *  The DynamicStreamingVideoSource class represents a streaming video source and can be
  *  used for streaming pre-recorded video or live streaming video.  In addition,
  *  it can support a single stream or multiple streams associated with different
- *  bitrates.  The VideoPlayer and VideoElement
- *  classes can take a StreamingVideoSource instance as its source
+ *  bitrates.  The VideoPlayer and VideoDisplay
+ *  classes can take a DynamicStreamingVideoSource instance as its source
  *  property.
  *
  *  @see spark.components.VideoPlayer
- *  @see spark.primitives.VideoElement
+ *  @see spark.components.VideoDisplay
  *
  *  @langversion 3.0
  *  @playerversion Flash 10
  *  @playerversion AIR 1.5
  *  @productversion Flex 4
  */
-public class StreamingVideoSource extends Object
+public class DynamicStreamingVideoSource extends Object
 {
     //--------------------------------------------------------------------------
     //
@@ -38,7 +38,7 @@
     //
     //--------------------------------------------------------------------------

-    public function StreamingVideoSource()
+    public function DynamicStreamingVideoSource()
     {
         super();
     }
@@ -50,38 +50,33 @@
     //--------------------------------------------------------------------------

     //----------------------------------
-    //  live
+    //  initialIndex
     //----------------------------------
-
-    private var _live:Boolean = false;
-
-    [Inspectable(category="General", defaultValue="false")]
-
+
+    private var _initialIndex:int;
+
+    [Inspectable(category="General")]
+
     /**
-     *  A Boolean value that is true if the video stream is live.
-     *
-     *
Set the live property to false when sending
-     *  a prerecorded video stream to the video player and to true
-     *  when sending real-time data such as a live broadcast.

-     *
-     *  @default false
+     *  The preferred starting index.  This corresponds to
+     *  the stream item that should be attempted first.
      *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
-     */
-    public function get live():Boolean
+     */
+    public function get initialIndex():int
     {
-        return _live;
+        return _initialIndex;
     }

     /**
      *  @private
      */
-    public function set live(value:Boolean):void
+    public function set initialIndex(value:int):void
     {
-        _live = value;
+        _initialIndex = value;
     }

     //----------------------------------
@@ -117,12 +112,9 @@
     //  streamItems
     //----------------------------------

-    private var _streamItems:Array;
+    private var _streamItems:Vector.<DynamicStreamingVideoItem>;

     [Inspectable(category="General")]
-    [ArrayElementType("spark.components.mediaClasses.StreamItem")]
-
-    // FIXME (rfrishbe): change to vectors when possible

     /**
      *  The metadata info object with properties describing the FLB file.
@@ -132,7 +124,7 @@
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
-    public function get streamItems():Array
+    public function get streamItems():Vector.<DynamicStreamingVideoItem>
     {
         return _streamItems;
     }
@@ -140,9 +132,45 @@
     /**
      *  @private
      */
-    public function set streamItems(value:Array):void
+    public function set streamItems(value:Vector.<DynamicStreamingVideoItem>):void
     {
         _streamItems = value;
+    }
+
+    //----------------------------------
+    //  streamType
+    //----------------------------------
+
+    private var _streamType:String = "any";
+
+    [Inspectable(category="General", enumeration="any,live,recorded", defaultValue="any")]
+
+    /**
+     *  The type of stream we are trying to connect to.
+     *
+     *
If the streamType is any, then we will attempt to
+     *  connect to a live stream first.  If no live stream is found, we will
+     *  attempt to connect to a recorded stream.  If no recorded stream is found,
+     *  then a live stream will be created.

+     *
+     *  @default any
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function get streamType():String
+    {
+        return _streamType;
+    }
+
+    /**
+     *  @private
+     */
+    public function set streamType(value:String):void
+    {
+        _streamType = value;
     }

 }


fix RenderingController to have mesh/scene bindings counters in order to listen to each binding parameter only once and remove the callback when the corresponding binding is not used anymore

--- src/aerys/minko/scene/controller/scene/RenderingController.as
+++ src/aerys/minko/scene/controller/scene/RenderingController.as
@@ -61,6 +61,8 @@

 		private var _meshToDrawCalls			: Dictionary;
 		private var _drawCallToMeshBindings		: Dictionary;
+        private var _meshBindingsUsageCount     : Dictionary;
+        private var _sceneBindingsUsageCount    : Object;

 		private var _postProcessingBackBuffer	: RenderTarget;
 		private var _postProcessingEffect		: Effect;
@@ -69,19 +71,6 @@

 		private var _lastViewportWidth			: Number;
 		private var _lastViewportHeight			: Number;
-
-		/**
-		 * Index meshes by their own databinding.
-		 *   * this is required to handle meshBindings.properyChange without
-		 *		having to check all meshes.
-		 *
-		 * Another way would be to put a field 'associatedSceneNode' into
-		 * the associated DataBindings object, as there is always a 1-1 relationship
-		 * between an ISceneNode and DataBindings instance.
-		 *
-		 * However, we don't want to trust AVM to handle circular references properly.
-		 */
-		private var _meshBindingsToMesh			: Dictionary;

 		/**
 		 * Index meshes by their effect.
@@ -144,9 +133,10 @@
 			_drawCallToPassInstance		= new Dictionary();
 			_drawCallToMeshBindings		= new Dictionary();
 			_passInstanceToDrawCalls	= new Dictionary();
-			_meshToDrawCalls			= new Dictionary();
-			_effectToMeshes				= new Dictionary();
-			_meshBindingsToMesh			= new Dictionary();
+			_meshToDrawCalls			= new Dictionary(true);
+            _meshBindingsUsageCount     = new Dictionary(true);
+            _sceneBindingsUsageCount    = {};
+			_effectToMeshes				= new Dictionary(true);
 			_stashedPropertyChanges		= new Dictionary();

 			targetAdded.add(targetAddedHandler);
@@ -454,8 +444,15 @@

 			var material : Material = mesh.material;

-			if (material && material.effect)
-				removeDrawCalls(mesh, material.effect);
+			if (!material)
+                return ;
+
+            var effect  : Effect    = material.effect;
+
+            if (!effect)
+                return ;
+
+			removeDrawCalls(mesh, material.effect);
 		}

 		private function effectPassesChangedHandler(effect : Effect) : void
@@ -601,6 +598,8 @@

 			// iterate on meshEffect passes
 			var drawCalls : Vector.<DrawCall>	= new <DrawCall>[];
+
+            _meshBindingsUsageCount[meshBindings] = {};

 			for (var i : uint = 0; i < numPasses; ++i)
 			{
@@ -629,8 +628,7 @@
 			}

 			// update indexes
-			_meshToDrawCalls[mesh]				= drawCalls;
-			_meshBindingsToMesh[meshBindings]	= mesh;
+			_meshToDrawCalls[mesh] = drawCalls;

 			if (!_effectToMeshes[effect])
 			{
@@ -657,10 +655,11 @@

 				unbind(passInstance, drawCall, meshBindings);
 			}
+
+            delete _meshBindingsUsageCount[meshBindings];

 			// update indexes
 			delete _meshToDrawCalls[mesh];
-			delete _meshBindingsToMesh[meshBindings];

 			var meshesWithSameEffect : Vector.<Mesh> = _effectToMeshes[effect];

@@ -743,7 +742,7 @@
 				{
 					var drawCall			: DrawCall			= drawCalls[drawCallId];
 					var meshBindings		: DataBindings		= _drawCallToMeshBindings[drawCall];
-					var meshGeometry		: Geometry			= Mesh(_meshBindingsToMesh[meshBindings]).geometry
+					var meshGeometry		: Geometry			= (meshBindings.owner as Mesh).geometry
 					var meshChanges			: Vector.<String>	= _stashedPropertyChanges[meshBindings];

 					var needUpdateFromMesh	: Boolean 			= meshChanges != null ?
@@ -789,12 +788,12 @@
 							  drawCall		: DrawCall,
 							  meshBindings	: DataBindings) : void
 		{
-			var sceneBindings	: DataBindings	= _scene.bindings;
-
-			// add callbacks on binding changes
-			var signature		: Signature		= passInstance.signature;
-			var numKeys			: uint			= signature.numKeys;
-
+			var sceneBindings	        : DataBindings	= _scene.bindings;
+            var meshBindingsUsageCount  : Object        = _meshBindingsUsageCount[meshBindings];
+			var signature       	    : Signature		= passInstance.signature;
+			var numKeys	    	    	: uint			= signature.numKeys;
+
+            // add callbacks on binding changes
 			for (var i : uint = 0; i < numKeys; ++i)
 			{
 				var key 	: String	= signature.getKey(i);
@@ -802,11 +801,15 @@

 				if (flags & Signature.SOURCE_MESH)
                 {
+                    meshBindingsUsageCount[key]++;
                     if (!meshBindings.hasCallback(key, bindingsPropertyChangedHandler))
 					    meshBindings.addCallback(key, bindingsPropertyChangedHandler);
                 }
                 else if (!sceneBindings.hasCallback(key, bindingsPropertyChangedHandler))
-                        sceneBindings.addCallback(key, bindingsPropertyChangedHandler);
+                {
+                    _sceneBindingsUsageCount[key]++;
+                    sceneBindings.addCallback(key, bindingsPropertyChangedHandler);
+                }
 			}

 			// retain the shader
@@ -830,7 +833,8 @@
 								drawCall		: DrawCall,
 								meshBindings	: DataBindings) : void
 		{
-			var sceneBindings	: DataBindings	= _scene.bindings;
+			var sceneBindings	        : DataBindings	= _scene.bindings;
+            var meshBindingsUsageCount  : Object        = _meshBindingsUsageCount[meshBindings];

 			drawCall.unsetBindings(meshBindings, sceneBindings);

@@ -846,9 +850,23 @@
     				var flags	: uint		= signature.getFlags(i);

     				if (flags & Signature.SOURCE_MESH)
-    					meshBindings.removeCallback(key, bindingsPropertyChangedHandler);
+                    {
+                        meshBindingsUsageCount[key]--;
+                        if (meshBindingsUsageCount[key] == 0)
+                        {
+    					    meshBindings.removeCallback(key, bindingsPropertyChangedHandler);
+                            delete meshBindingsUsageCount[key];
+                        }
+                    }
     				else
-    					sceneBindings.removeCallback(key, bindingsPropertyChangedHandler);
+                    {
+                        _sceneBindingsUsageCount[key]--;
+                        if (meshBindingsUsageCount[key] == 0)
+                        {
+        					sceneBindings.removeCallback(key, bindingsPropertyChangedHandler);
+                            delete _sceneBindingsUsageCount[key];
+                        }
+                    }
     			}

     			// release the shader


comment function

comment function

--- src/org/mangui/hls/stream/StreamBuffer.as
+++ src/org/mangui/hls/stream/StreamBuffer.as
@@ -251,6 +251,9 @@
             }
         }

+        /*
+            helper function used to sort tags, lower values have highest priority
+        */
         private function gettagrank(tag : FLVTag) : uint {
             switch(tag.type) {
                 case FLVTag.DISCONTINUITY:


Change 20080724-maxcarlson-R by maxcarlson@Roboto on 2008-07-24 13:26:03 PDT
    in /Users/maxcarlson/openlaszlo/trunk-clean
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Fix resource scaling for zero-height views with stretches in swf8

Bugs Fixed: LPP-6656 -  'stretches' broken in resizelayout in swf8

Technical Reviewer: hminsky
QA Reviewer: a.bargull@intensis.de

Details: If scalex/y is set to 0, reset it to 1 to prevent division by zero.

Tests: See LPP-6656

git-svn-id: d62bde4b5aa582fdf07c8d403e53e0399a7ed285@10479 fa20e4f9-1d0a-0410-b5f3-dc9c16b8b17c

--- WEB-INF/lps/lfc/kernel/swf/LzSprite.as
+++ WEB-INF/lps/lfc/kernel/swf/LzSprite.as
@@ -619,6 +619,7 @@
         // <scale as fraction> = ( <desired dim in px> / <resource dim
         // in px> ) Note the empty resource is a 100x100px clip
         var xscale = ((this.resourcewidth == 0) ? (v/100) : (v/this.resourcewidth));
+        if (xscale == 0) xscale = 1;
         this._xscale = xscale;
         // clip scale is in percent
         this.__LZmovieClipRef._xscale = xscale * 100;
@@ -672,6 +673,7 @@
         // <scale as fraction> = ( <desired dim in px> / <resource dim
         // in px> ) Note the empty resource is a 100x100px clip
         var yscale = ((this.resourceheight == 0) ? (v/100) : (v/this.resourceheight));
+        if (yscale == 0) yscale = 1;
         this._yscale = yscale;
         // clip scale is in percent
         this.__LZmovieClipRef._yscale = yscale * 100;


AsyncSort now defaults to using Array.sort() if no compare function is given (because it's faster).

--- WeaveCore/src/weave/utils/AsyncSort.as
+++ WeaveCore/src/weave/utils/AsyncSort.as
@@ -41,7 +41,7 @@
 		 * This function will sort an Array (or Vector) immediately.
 		 * @param array An Array (or Vector) to sort in place.
 		 * @param compareFunction The function used to compare items in the array.
-		 */
+		 */
 		public static function sortImmediately(array:*, compareFunction:Function = null):void
 		{
 			if (!_immediateSorter)
@@ -132,7 +132,7 @@
 		public function beginSort(arrayToSort:*, compareFunction:Function = null):void
 		{
 			// initialize
-			compare = compareFunction || defaultCompare;
+			compare = compareFunction;
 			original = arrayToSort || [];
 			source = original;
 			length = original.length;
@@ -173,6 +173,15 @@

 		private function iterate(stopTime:int):Number
 		{
+			if (compare === null)
+			{
+				if (original.length && original[0] is Number)
+					original.sort(Array.NUMERIC);
+				else
+					original.sort();
+				return 1;
+			}
+
 			var time:int = getTimer();

 			while (getTimer() < stopTime)
@@ -252,8 +261,8 @@
 		 ** Testing **
 		 *************/

-		//test(false); // Class('weave.utils.AsyncSort').test(false)
 		/*
+			Built-in sort is slower when using a compare function because it uses more comparisons.
 			Array.sort 50 numbers; 0.002 seconds; 487 comparisons
 			Merge Sort 50 numbers; 0.001 seconds; 208 comparisons
 			Array.sort 3000 numbers; 0.304 seconds; 87367 comparisons
@@ -267,33 +276,67 @@
 			Array.sort 50000 numbers; 37.285 seconds; 10238787 comparisons
 			Merge Sort 50000 numbers; 2.603 seconds; 585089 comparisons
 		*/
-		public static function test(useDefaultSort:Boolean):void
-		{
-			for each (var n:uint in [0,1,2,3,4,5,50,3000,6000,12000,25000,50000])
-			{
-				var array:Array = [];
-				for (var i:int = 0; i < n; i++)
-					array.push(Math.random() < .5 ? NaN : uint(Math.random()*100));
-				var array2:Array = array.concat();
+		/*
+			Built-in sort is faster when no compare function is given.
+			Array.sort 50 numbers; 0 seconds
+			Merge Sort 50 numbers; 0.001 seconds
+			Array.sort 3000 numbers; 0.003 seconds
+			Merge Sort 3000 numbers; 0.056 seconds
+			Array.sort 6000 numbers; 0.006 seconds
+			Merge Sort 6000 numbers; 0.123 seconds
+			Array.sort 12000 numbers; 0.012 seconds
+			Merge Sort 12000 numbers; 0.261 seconds
+			Array.sort 25000 numbers; 0.026 seconds
+			Merge Sort 25000 numbers; 0.599 seconds
+			Array.sort 50000 numbers; 0.058 seconds
+			Merge Sort 50000 numbers; 1.284 seconds
+		*/
+		private static var _testArrays:Array;
+		private static var _testType:int = -1;
+		public static function test(compare:Object, testType:int = 0):void
+		{
+			if (testType != _testType)
+			{
+				_testType = testType;
+				_testArrays = [];
+				for each (var n:uint in [0,1,2,3,4,5,50,3000,6000,12000,25000,50000])
+				{
+					var array:Array = [];
+					for (var i:int = 0; i < n; i++)
+					{
+						if (testType == 0)
+							array.push(uint(Math.random()*100));
+						else if (testType == 1)
+							array.push(Math.random() < .5 ? NaN : uint(Math.random()*100));
+						else if (testType == 2)
+							array.push('a' + Math.random());
+					}
+					_testArrays.push(array);
+				}
+			}
+			trace("testType =", testType);
+
+			_debugCompareFunction = compare as Function;
+			for each (var _array:Array in _testArrays)
+			{
+				var array1:Array = _array.concat();
+				var array2:Array = _array.concat();

 				var start:int = getTimer();
 				_debugCompareCount = 0;
-				if (useDefaultSort)
-					array.sort();
+				if (compare === null)
+					array1.sort();
 				else
-					array.sort(_debugCompare);
-				trace('Array.sort', n, 'numbers;', (getTimer() - start) / 1000, 'seconds;',_debugCompareCount,'comparisons');
+					array1.sort(_debugCompareCounter);
+				trace('Array.sort', array1.length, 'numbers;', (getTimer() - start) / 1000, 'seconds;', _debugCompareCount ? (_debugCompareCount+' comparisons') : '');

 				start = getTimer();
 				_debugCompareCount = 0;
-				if (useDefaultSort)
-					sortImmediately(array2);
-				else
-					sortImmediately(array2, _debugCompare);
+				sortImmediately(array2, compare is Function ? _debugCompareCounter : null);
 				//trace('Merge Sort', n, 'numbers;', _immediateSorter.elapsed / 1000, 'seconds;',_debugCompareCount,'comparisons');
-				trace('Merge Sort', n, 'numbers;', (getTimer() - start) / 1000, 'seconds;',_debugCompareCount,'comparisons');
+				trace('Merge Sort', array2.length, 'numbers;', (getTimer() - start) / 1000, 'seconds;', _debugCompareCount ? (_debugCompareCount+' comparisons') : '');

-				if (array2.length == 1 && ObjectUtil.compare(array[0],array2[0]) != 0)
+				if (array2.length == 1 && ObjectUtil.compare(array1[0],array2[0]) != 0)
 					throw new Error("sort failed on array length 1");

 				verifyNumbersSorted(array2);
@@ -310,10 +353,11 @@
 			}
 		}
 		private static var _debugCompareCount:int = 0;
-		private static function _debugCompare(a:Object, b:Object):int
+		private static var _debugCompareFunction:Function = null;
+		private static function _debugCompareCounter(a:Object, b:Object):int
 		{
 			_debugCompareCount++;
-			return ObjectUtil.compare(a, b);
+			return _debugCompareFunction(a, b);
 		}
 	}
 }


- fixed a bug in the calculation of CSS declaration specificity, which caused pseudo classes to be ignored in the calculation

git-svn-id: e38e7cdd6ace00d8230583a2d3b43e9a55f5c011@167 bc4816be-ef27-423a-9c4d-fc420be121a2

--- src/reprise/css/CSSDeclarationListItem.as
+++ src/reprise/css/CSSDeclarationListItem.as
@@ -156,7 +156,9 @@
 			while (i--)
 			{
 				spec += specificityForPattern(patterns[i]);
-			}
+			}
+
+			trace("spec " + spec + " for selector " + selector);
 			return spec;
 		}

@@ -167,7 +169,7 @@
 			var specificityFactorId : Number = 100;

 			var spec : Number = 0;
-			var patternParts : Array = pattern.split('.');
+			var patternParts : Array = pattern.split(':').join('.:').split('.');

 			//add specificity of classes multiplied by class count
 			spec += (patternParts.length - 1) * specificityFactorClass;


- added missing super.execute() call

- added missing super.execute() call

git-svn-id: e38e7cdd6ace00d8230583a2d3b43e9a55f5c011@829 bc4816be-ef27-423a-9c4d-fc420be121a2

--- src/reprise/utils/AsynchronousDelegate.as
+++ src/reprise/utils/AsynchronousDelegate.as
@@ -50,6 +50,7 @@

 		override public function execute(...args) : void
 		{
+			super.execute();
 			if (m_waitsForEvent)
 			{
 				EventDispatcher(m_executionDelegate.scope()).addEventListener(


6 OrderedStringMap.getAllKeys()

6 OrderedStringMap.getAllKeys()

--- raw/src/org/yellcorp/map/OrderedStringMap.as
+++ raw/src/org/yellcorp/map/OrderedStringMap.as
@@ -65,6 +65,11 @@
     public function get length():int
     {
         return keyOrder.length;
+    }
+
+    public function getAllKeys():Array
+    {
+        return keyOrder.slice();
     }

     public function getIndexOfKey(key:String):int


Transferred from the Adobe Open Source Subversion Repository

Revision: 1218
Author:   jimurphy@adobe.com
Date:     2008-04-15T16:09:32.174552Z

Log Message:
-----------
merge 3.0.x[1069:1202] -> trunk

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/in/air/air_version.txt</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/ProgressBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/lib/flex-messaging-common.jar</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/codec/PNGEncoder.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/MultiTopicProducer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/codec/JPEGEncoder.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/skins/halo/StatusBarBackgroundSkin.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/xml/SchemaTypeRegistry.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/http/mxml/HTTPService.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/codec/IImageEncoder.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/utils/ObjectProxy.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/MultiTopicConsumer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/xml/IXMLDecoder.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/soap/SOAPFault.as</path>
<path kind="file" action="M">/flex/sdk/trunk/build.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/ComboBox.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/soap/WebService.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/Channel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/soap/Operation.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/skins/halo/HaloColors.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/TextArea.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/skins/halo/SliderThumbSkin.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/xml/IXMLEncoder.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/RoundedRectangle.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/xml/SimpleXMLEncoder.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/soap/SOAPHeader.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/soap/mxml/WebService.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/wsdl/WSDLBinding.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/soap/mxml/Operation.as</path>

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

--- frameworks/projects/framework/src/mx/graphics/codec/PNGEncoder.as
+++ frameworks/projects/framework/src/mx/graphics/codec/PNGEncoder.as
@@ -97,7 +97,7 @@
      *
      *  @param bitmapData The input BitmapData object.
      *
-     *  @returns A ByteArray object containing PNG-encoded image data.
+     *  @return Returns a ByteArray object containing PNG-encoded image data.
      */
     public function encode(bitmapData:BitmapData):ByteArray
     {
@@ -127,7 +127,7 @@
 	 *  is ignored but you still must represent each pixel
      *  as four bytes in ARGB format.
      *
-     *  @returns A ByteArray object containing PNG-encoded image data.
+     *  @return Returns a ByteArray object containing PNG-encoded image data.
      */
     public function encodeByteArray(byteArray:ByteArray, width:int, height:int,
 									transparent:Boolean = true):ByteArray


Transferred from the Adobe Open Source Subversion Repository

Revision: 16262
Author:   dloverin@adobe.com
Date:     2010-05-20T18:44:39.210129Z

Log Message:
-----------
Move mx components out of framework.swc into mx.swc

The new mx.swc library lives in the libs/mx directory.

QE notes: Of the 5 failures I saw: 1 was intermittent and 4 are not a bug.
Managers/StyleManager/AdvancedCSS/descendantSelectors/AdvancedCSS_descendantSelectors_Style descendantSelector_combining_nested_style
    This failure was intermittent.

mx/effects/Resize/Containers/Resize_Containers Effects_Resize_Containers_ApplicationControlBar_FromTo
mx/effects/Resize/Containers/Resize_Containers Effects_Resize_Containers_ApplicationControlBar_By
mx/effects/Resize/Containers/Resize_Containers Effects_Resize_Containers_ControlBar_FromTo
mx/effects/Resize/Containers/Resize_Containers Effects_Resize_Containers_ControlBar_By
    These failures are due to my code changes but I believe the old behavior was incorrect. When a control bar is the last child in a Panel it should appear at the bottom of the Panel. In the test case an ApplicationControlBar/ContorlBar is added to an empty Panel, making it the last child in the Panel. So it should appear at the bottom of the Panel instead of inside the Panel.

Doc notes: new library, mx.swc
Bugs:
Reviewer: Alex
Tests run:
Is noteworthy for integration: Yes

Modified Paths:
--------------
740 paths were modified

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

--- frameworks/projects/framework/src/mx/managers/PopUpManagerImpl.as
+++ frameworks/projects/framework/src/mx/managers/PopUpManagerImpl.as
@@ -28,8 +28,6 @@
 import flash.utils.Proxy;

 import mx.automation.IAutomationObject;
-import mx.containers.Canvas;
-import mx.controls.Alert;
 import mx.core.FlexGlobals;
 import mx.core.FlexSprite;
 import mx.core.IChildList;


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@1267488 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mx/src/mx/accessibility/TitleWindowAccImpl.as
+++ frameworks/projects/mx/src/mx/accessibility/TitleWindowAccImpl.as
@@ -1,13 +1,3 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2004-2007 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.accessibility
 {


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@1268982 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mx/src/mx/controls/menuClasses/MenuBarItem.as
+++ frameworks/projects/mx/src/mx/controls/menuClasses/MenuBarItem.as
@@ -1,3 +1,13 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2003-2007 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.controls.menuClasses
 {


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@1269543 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mx/src/mx/effects/effectClasses/WipeDownInstance.as
+++ frameworks/projects/mx/src/mx/effects/effectClasses/WipeDownInstance.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.effects.effectClasses
 {


final touch up in sampling

final touch up in sampling

--- WeaveUISpark/src/weave/visualization/plotters/RadVizPlotter.as
+++ WeaveUISpark/src/weave/visualization/plotters/RadVizPlotter.as
@@ -24,6 +24,8 @@
 	import flash.display.Shape;
 	import flash.geom.Point;
 	import flash.utils.Dictionary;
+
+	import mx.controls.Alert;

 	import weave.Weave;
 	import weave.api.WeaveAPI;
@@ -580,11 +582,13 @@
 				}
 				else
 				{
+					Alert.show(lang("No data found."))
 					return;
 				}
 				if (originalArray.length < sampleSizeRows.value)
 				{
 					sampledArray = originalArray; // sample size is bigger than the data set.
+					Alert.show(lang("Data sampled successfully."))
 				}
 				else // sampling begins here
 				{
@@ -616,7 +620,7 @@
 					else // column sampling begins here
 					{
 						i = sampleSizeColumns.value - 2; // we need to reduce this number by one because the title row already accounts for a row
-						length = transposedSampledArray.length - 2; // accounted for the first two columns removed.
+						length = transposedSampledArray.length; // accounted for the first two columns removed.
 						sampledArray = []; // making this sampled array reusable
 						while( i != 0 )
 						{
@@ -640,7 +644,8 @@
 					}
 					var sampledCSVDataSource:CSVDataSource = WeaveAPI.globalHashMap.requestObject(sampleTitle.value, CSVDataSource, false);
 					sampledCSVDataSource.setCSVData(sampledArray);
-					sampledCSVDataSource.keyType.value = originalCSVDataSource.keyType.value;
+					sampledCSVDataSource.keyType.value = originalCSVDataSource.keyType.value;
+					Alert.show(lang("Data sampled successfully."));
 					sampleTitle.value = "";
 				}
 			}