Transferred from the Adobe Open Source Subversion Repository

Revision: 2106
Author:   jimurphy@adobe.com
Date:     2008-06-17T15:08:59.757217Z

Log Message:
-----------
Merge 3.0.x revisions [2073,2075-2077,2079,2093,2095,2103] -> trunk

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/skins/halo/ButtonBarButtonSkin.as</path>
<path kind="dir" action="M">/flex/sdk/trunk/modules/asc</path>
<path kind="dir" action="M">/flex/sdk/trunk</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/DataGrid.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/ViewStack.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/Accordion.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataGridHeader.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/air-config.xml</path>

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

--- frameworks/projects/mx/src/mx/containers/ViewStack.as
+++ frameworks/projects/mx/src/mx/containers/ViewStack.as
@@ -203,604 +203,602 @@
  */
 public class ViewStack extends Container implements IHistoryManagerClient
 {
-	include "../core/Version.as";
-
-	//--------------------------------------------------------------------------
-	//
-	//  Constructor
-	//
-	//--------------------------------------------------------------------------
-
-	/**
-	 *  Constructor.
-	 */
-	public function ViewStack()
-	{
-		super();
-
-		addEventListener(ChildExistenceChangedEvent.CHILD_ADD, childAddHandler);
-		addEventListener(ChildExistenceChangedEvent.CHILD_REMOVE,
-						 childRemoveHandler);
-	}
-
-	//--------------------------------------------------------------------------
-	//
-	//  Variables
-	//
-	//--------------------------------------------------------------------------
-
-	/**
-	 *  @private
-	 */
-	private var needToInstantiateSelectedChild:Boolean = false;
-
-	/**
-	 *  @private
-	 *  This flag gets set when selectedIndex is set.
-	 *  Later, when measure()
-	 *  is called, it causes the HistoryManager to save the state.
-	 */
-	private var bSaveState:Boolean = false;
-
-	/**
-	 *  @private
-	 *  This flag gets set by loadState().
-	 *  It prevents the newly restored state from being saved.
-	 */
-	private var bInLoadState:Boolean = false;
-
-	/**
-	 *  @private
-	 *  True until commitProperties has been called at least once.
-	 */
-	private var firstTime:Boolean = true;
-
-	/**
-	 *  @private
-	 *  We'll measure ourselves once and then store the results here
-	 *  for the lifetime of the ViewStack
-	 */
-	mx_internal var vsMinWidth:Number;
-	mx_internal var vsMinHeight:Number;
-	mx_internal var vsPreferredWidth:Number;
-	mx_internal var vsPreferredHeight:Number;
-
-	/**
-	 *  @private
-	 *  Remember which child has an overlay mask, if any.
-	 */
-	private var overlayChild:Container;
-
-	/**
-	 *  @private
-	 *  Keep track of the overlay's targetArea
-	 */
-	private var overlayTargetArea:RoundedRectangle;
-
-	/**
-	 *  @private
-	 *  Store the last selectedIndex
-	 */
-	private var lastIndex:int = -1;
-
-	/**
-	 *  @private
-	 *  Whether a change event has to be dispatched in commitProperties()
-	 */
-	private var dispatchChangeEventPending:Boolean = false;
-
-	//--------------------------------------------------------------------------
-	//
-	//  Overridden properties
-	//
-	//--------------------------------------------------------------------------
-
-	//----------------------------------
-	//  autoLayout
-	//----------------------------------
-
-	/**
-	 *  @private
-	 *  autoLayout is always true for ViewStack.
-	 */
-	override public function get autoLayout():Boolean
-	{
-		return true;
-	}
-
-	/**
-	 *  @private
-	 *  autoLayout is always true for ViewStack
-	 *  and can't be changed by this setter.
-	 *
-	 *  We can probably find a way to make autoLayout work with Accordion
-	 *  and ViewStack, but right now there are problems if deferred
-	 *  instantiation runs at the same time as an effect. (Bug 79174)
-	 */
-	override public function set autoLayout(value:Boolean):void
-	{
-	}
-
-	//----------------------------------
-	//  horizontalScrollPolicy
-	//----------------------------------
-
-	[Inspectable(environment="none")]
-
-	/**
-	 *  @private
-	 *  horizontalScrollPolicy is always OFF for ViewStack.
-	 */
-	override public function get horizontalScrollPolicy():String
-	{
-		return ScrollPolicy.OFF;
-	}
-
-	/**
-	 *  @private
-	 *  horizontalScrollPolicy is always OFF for ViewStack
-	 *  and can't be changed by this setter.
-	 */
-	override public function set horizontalScrollPolicy(value:String):void
-	{
-	}
-
-	//----------------------------------
-	//  verticalScrollPolicy
-	//----------------------------------
-
-	[Inspectable(environment="none")]
-
-	/**
-	 *  @private
-	 *  verticalScrollPolicy is always OFF for ViewStack.
-	 */
-	override public function get verticalScrollPolicy():String
-	{
-		return ScrollPolicy.OFF;
-	}
-
-	/**
-	 *  @private
-	 *  verticalScrollPolicy is always OFF for ViewStack
-	 *  and can't be changed by this setter.
-	 */
-	override public function set verticalScrollPolicy(value:String):void
-	{
-	}
-
-	//--------------------------------------------------------------------------
-	//
-	//  Properties
-	//
-	//--------------------------------------------------------------------------
-
-	//----------------------------------
-	//  contentHeight
-	//----------------------------------
-
-	/**
-	 *  The height of the area, in pixels, in which content is displayed.
-	 *  You can override this getter if your content
-	 *  does not occupy the entire area of the ViewStack container.
-	 */
-	protected function get contentHeight():Number
-	{
-		var vm:EdgeMetrics = viewMetricsAndPadding;
-		return unscaledHeight - vm.top - vm.bottom;
-	}
-
-	//----------------------------------
-	//  contentWidth
-	//----------------------------------
-
-	/**
-	 *  The width of the area, in pixels, in which content is displayed.
-	 *  You can override this getter if your content
-	 *  does not occupy the entire area of the ViewStack container.
-	 */
-	protected function get contentWidth():Number
-	{
-		var vm:EdgeMetrics = viewMetricsAndPadding;
-		return unscaledWidth - vm.left - vm.right;
-	}
-
-	//----------------------------------
-	//  contentX
-	//----------------------------------
-
-	/**
-	 *  The x coordinate of the area of the ViewStack container
-	 *  in which content is displayed, in pixels.
-	 *  The default value is equal to the value of the
-	 *  paddingLeft style property,
-	 *  which has a default value of 0.
-	 *
-	 *  Override the get() method if you do not want
-	 *  your content to start layout at x = 0.
-	 */
-	protected function get contentX():Number
-	{
-		return getStyle("paddingLeft");
-	}
-
-	//----------------------------------
-	//  contentY
-	//----------------------------------
-
-	/**
-	 *  The y coordinate of the area of the ViewStack container
-	 *  in which content is displayed, in pixels.
-	 *  The default value is equal to the value of the
-	 *  paddingTop style property,
-	 *  which has a default value of 0.
-	 *
-	 *  Override the get() method if you do not want
-	 *  your content to start layout at y = 0.
-	 */
-	protected function get contentY():Number
-	{
-		return getStyle("paddingTop");
-	}
-
-	//----------------------------------
-	//  historyManagementEnabled
-	//----------------------------------
-
-	/**
-	 *  @private
-	 *  Storage for the historyManagementEnabled property.
-	 */
-	mx_internal var _historyManagementEnabled:Boolean = false;
-
-	/**
-	 *  @private
-	 */
-	private var historyManagementEnabledChanged:Boolean = false;
-
-	[Inspectable(defaultValue="true")]
-
-	/**
-	 *  If true, enables history management
-	 *  within this ViewStack container.
-	 *  As the user navigates from one child to another,
-	 *  the browser remembers which children were visited.
-	 *  The user can then click the browser's Back and Forward buttons
-	 *  to move through this navigation history.
-	 *
-	 *  @default false
-	 *
-	 *  @see mx.managers.HistoryManager
-	 */
-	public function get historyManagementEnabled():Boolean
-	{
-		return _historyManagementEnabled;
-	}
-
-	/**
-	 *  @private
-	 */
-	public function set historyManagementEnabled(value:Boolean):void
-	{
-		if (value != _historyManagementEnabled)
-		{
-			_historyManagementEnabled = value;
-			historyManagementEnabledChanged = true;
-
-			invalidateProperties();
-		}
-	}
-
-	//----------------------------------
-	//  resizeToContent
-	//----------------------------------
-
-	/**
-	 *  @private
-	 *  Storage for the resizeToContent property.
-	 */
-	private var _resizeToContent:Boolean = false;
-
-	/**
-	 *  If true, the ViewStack container automatically
-	 *  resizes to the size of its current child.
-	 *
-	 *  @default false
-	 */
-	public function get resizeToContent():Boolean
-	{
-		return _resizeToContent;
-	}
-
-	/**
-	 *  @private
-	 */
-	public function set resizeToContent(value:Boolean):void
-	{
-		if (value != _resizeToContent)
-		{
-			_resizeToContent = value;
-
-			if (value)
-				invalidateSize();
-		}
-	}
-
-	//----------------------------------
-	//  selectedChild
-	//----------------------------------
-
-	[Bindable("valueCommit")]
-
-	/**
-	 *  A reference to the currently visible child container.
-	 *  The default is a reference to the first child.
-	 *  If there are no children, this property is null.
-	 *
-	 *
Note: You can only set this property in an
-	 *  ActionScript statement, not in MXML.

-	 */
-	public function get selectedChild():Container
-	{
-		if (selectedIndex == -1)
-			return null;
-
-		return Container(getChildAt(selectedIndex));
-	}
-
-	/**
-	 *  @private
-	 */
-	public function set selectedChild(
-							value:Container):void
-	{
-		var newIndex:int = getChildIndex(DisplayObject(value));
-
-		if (newIndex >= 0 && newIndex < numChildren)
-			selectedIndex = newIndex;
-	}
-
-	//----------------------------------
-	//  selectedIndex
-	//----------------------------------
-
-	/**
-	 *  @private
-	 *  Storage for the selectedIndex property.
-	 */
-	private var _selectedIndex:int = -1;
-
-	/**
-	 *  @private
-	 */
-	private var proposedSelectedIndex:int = -1;
-
-	/**
-	 *  @private
-	 */
-	private var initialSelectedIndex:int = -1;
-
-	[Bindable("change")]
-	[Bindable("valueCommit")]
-	[Inspectable(category="General")]
-
-	/**
-	 *  The zero-based index of the currently visible child container.
-	 *  Child indexes are in the range 0, 1, 2, ..., n - 1,
-	 *  where n is the number of children.
-	 *  The default value is 0, corresponding to the first child.
-	 *  If there are no children, the value of this property is -1.
-	 *
-	 *
Note: When you add a new child to a ViewStack
-	 *  container, the selectedIndex property is automatically
-	 *  adjusted, if necessary, so that the selected child remains selected.

-	 */
-	public function get selectedIndex():int
-	{
-		return proposedSelectedIndex == -1 ?
-			   _selectedIndex :
-			   proposedSelectedIndex;
-	}
-
-	/**
-	 *  @private
-	 */
-	public function set selectedIndex(value:int):void
-	{
-		// Bail if the index isn't changing.
-		if (value == selectedIndex)
-			return;
-
-		// Propose the specified value as the new value for selectedIndex.
-		// It gets applied later when measure() calls commitSelectedIndex().
-		// The proposed value can be "out of range", because the children
-		// may not have been created yet, so the range check is handled
-		// in commitSelectedIndex(), not here. Other calls to this setter
-		// can change the proposed index before it is committed. Also,
-		// childAddHandler() proposes a value of 0 when it creates the first
-		// child, if no value has yet been proposed.
-		proposedSelectedIndex = value;
-		invalidateProperties();
-
-		// Set a flag which will cause the HistoryManager to save state
-		// the next time measure() is called.
-		if (historyManagementEnabled && _selectedIndex != -1 && !bInLoadState)
-			bSaveState = true;
-
-		dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
-	}
-
-	//--------------------------------------------------------------------------
-	//
-	//  Overridden methods: UIComponent
-	//
-	//--------------------------------------------------------------------------
-
-	/**
-	 *  @private
-	 */
-	override protected function commitProperties():void
-	{
-		super.commitProperties();
-
-		if (historyManagementEnabledChanged)
-		{
-			if (historyManagementEnabled)
-				HistoryManager.register(this);
-			else
-				HistoryManager.unregister(this);
-
-			historyManagementEnabledChanged = false;
-		}
-
-		if (proposedSelectedIndex != -1)
-		{
-			commitSelectedIndex(proposedSelectedIndex);
-			proposedSelectedIndex = -1;
-		}
-
-		if (needToInstantiateSelectedChild)
-		{
-			instantiateSelectedChild();
-			needToInstantiateSelectedChild = false;
-		}
-
-		// Dispatch the change event only after the child has been
-		// instantiated.
-		if (dispatchChangeEventPending)
-		{
-			dispatchChangeEvent(lastIndex, selectedIndex);
-			dispatchChangeEventPending = false;
-		}
-
-		if (firstTime)
-		{
-			firstTime = false;
-
-			// Add "added" and "removed" listeners to the system manager so we can
-			// register/un-register from the history manager when this component is
-			// added or removed from the display list.
-			systemManager.addEventListener(Event.ADDED, systemManager_addedHandler,
-					false, 0, true);
-			systemManager.addEventListener(Event.REMOVED, systemManager_removedHandler,
-					false, 0, true);
-		}
-
-	}
-
-	/**
-	 *  Calculates the default sizes and minimum and maximum values of the
-	 *  ViewStack container.
-	 *  For more information about the measure() method,
-	 *  see the UIComponent.measure() method.
-	 *
-	 *
The default size of a ViewStack container is the default size
-	 *  of its currently selected child, plus the padding and borders.
-	 *  If the ViewStack container has no children, its default size
-	 *  is just large enough for its padding and borders.

-	 *
-	 *
The minimum size of a ViewStack container is the minimum size
-	 *  of its currently selected child, plus the padding and borders.
-	 *  If the ViewStack container has no children, its minimum size
-	 *  is just large enough for its padding and borders.

-	 *
-	 *
This method does not change the maximum size of a ViewStack
-	 *  container - it remains unbounded.

-	 *
-	 *  @see mx.core.UIComponent#measure()
-	 */
-	override protected function measure():void
-	{
-		super.measure();
-
-		// A ViewStack measures itself based only on its selectedChild.
-		// The minimum, maximum, and preferred sizes are those of the
-		// selected child, plus the borders and margins.
-		var minWidth:Number = 0;
-		var minHeight:Number = 0;
-		var preferredWidth:Number = 0;
-		var preferredHeight:Number = 0;
-
-		// Only measure once.  Thereafter, we'll just use cached values.
-		//
-		// We need to copy the cached values into the measured fields
-		// again to handle the case where scaleX or scaleY is not 1.0.
-		// When the ViewStack is zoomed, code in UIComponent.measureSizes
-		// scales the measuredWidth/Height values every time that
-		// measureSizes is called.  (bug 100749)
-		if (vsPreferredWidth && !_resizeToContent)
-		{
-			measuredMinWidth = vsMinWidth;
-			measuredMinHeight = vsMinHeight;
-			measuredWidth = vsPreferredWidth;
-			measuredHeight = vsPreferredHeight;
-			return;
-		}
-
-		if (numChildren > 0 && selectedIndex != -1)
-		{
-			var child:Container =
-				Container(getChildAt(selectedIndex));
-
-			minWidth = child.minWidth;
-			preferredWidth = child.getExplicitOrMeasuredWidth();
-
-			minHeight = child.minHeight;
-			preferredHeight = child.getExplicitOrMeasuredHeight();
-		}
-
-		var vm:EdgeMetrics = viewMetricsAndPadding;
-
-		var wPadding:Number = vm.left + vm.right;
-		minWidth += wPadding;
-		preferredWidth += wPadding;
-
-		var hPadding:Number = vm.top + vm.bottom;
-		minHeight += hPadding;
-		preferredHeight += hPadding;
-
-		measuredMinWidth = minWidth;
-		measuredMinHeight = minHeight;
-		measuredWidth = preferredWidth;
-		measuredHeight = preferredHeight;
-
-		// If we're called before instantiateSelectedChild, then bail.
-		// We'll be called again later (instantiateSelectedChild calls
-		// invalidateSize), and we don't want to load values into the
-		// cache until we're fully initialized.  (bug 102639)
-		// This check was moved from the beginning of this function to
-		// here to fix bug 103665.
-		if (selectedChild && Container(selectedChild).numChildrenCreated == -1)
-			return;
-
-		// Don't remember sizes if we don't have any children
-		if (numChildren == 0)
-			return;
-
-		vsMinWidth = minWidth;
-		vsMinHeight = minHeight;
-		vsPreferredWidth = preferredWidth;
-		vsPreferredHeight = preferredHeight;
-	}
-
-	/**
-	 *  Responds to size changes by setting the positions and sizes
-	 *  of this container's children.
-	 *  For more information about the updateDisplayList() method,
-	 *  see the UIComponent.updateDisplayList() method.
-	 *
-	 *
Only one of its children is visible at a time, therefore,
-	 *  a ViewStack container positions and sizes only that child.

-	 *
-	 *
The selected child is positioned in the ViewStack container's
-	 *  upper-left corner, and allows for the ViewStack container's
-	 *  padding and borders.

-	 *
-	 *
If the selected child has a percentage width or
-	 *  height value, it is resized in that direction
-	 *  to fill the specified percentage of the ViewStack container's
-	 *  content area (i.e., the region inside its padding).

-	 *
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     */
+    public function ViewStack()
+    {
+        super();
+
+        addEventListener(ChildExistenceChangedEvent.CHILD_ADD, childAddHandler);
+        addEventListener(ChildExistenceChangedEvent.CHILD_REMOVE,
+                         childRemoveHandler);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private var needToInstantiateSelectedChild:Boolean = false;
+
+    /**
+     *  @private
+     *  This flag gets set when selectedIndex is set.
+     *  Later, when measure()
+     *  is called, it causes the HistoryManager to save the state.
+     */
+    private var bSaveState:Boolean = false;
+
+    /**
+     *  @private
+     *  This flag gets set by loadState().
+     *  It prevents the newly restored state from being saved.
+     */
+    private var bInLoadState:Boolean = false;
+
+    /**
+     *  @private
+     *  True until commitProperties has been called at least once.
+     */
+    private var firstTime:Boolean = true;
+
+    /**
+     *  @private
+     *  We'll measure ourselves once and then store the results here
+     *  for the lifetime of the ViewStack
+     */
+    mx_internal var vsMinWidth:Number;
+    mx_internal var vsMinHeight:Number;
+    mx_internal var vsPreferredWidth:Number;
+    mx_internal var vsPreferredHeight:Number;
+
+    /**
+     *  @private
+     *  Remember which child has an overlay mask, if any.
+     */
+    private var overlayChild:Container;
+
+    /**
+     *  @private
+     *  Keep track of the overlay's targetArea
+     */
+    private var overlayTargetArea:RoundedRectangle;
+
+    /**
+     *  @private
+     *  Store the last selectedIndex
+     */
+    private var lastIndex:int = -1;
+
+    /**
+     *  @private
+     *  Whether a change event has to be dispatched in commitProperties()
+     */
+    private var dispatchChangeEventPending:Boolean = false;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  autoLayout
+    //----------------------------------
+
+    /**
+     *  @private
+     *  autoLayout is always true for ViewStack.
+     */
+    override public function get autoLayout():Boolean
+    {
+        return true;
+    }
+
+    /**
+     *  @private
+     *  autoLayout is always true for ViewStack
+     *  and can't be changed by this setter.
+     *
+     *  We can probably find a way to make autoLayout work with Accordion
+     *  and ViewStack, but right now there are problems if deferred
+     *  instantiation runs at the same time as an effect. (Bug 79174)
+     */
+    override public function set autoLayout(value:Boolean):void
+    {
+    }
+
+    //----------------------------------
+    //  horizontalScrollPolicy
+    //----------------------------------
+
+    [Inspectable(environment="none")]
+
+    /**
+     *  @private
+     *  horizontalScrollPolicy is always OFF for ViewStack.
+     */
+    override public function get horizontalScrollPolicy():String
+    {
+        return ScrollPolicy.OFF;
+    }
+
+    /**
+     *  @private
+     *  horizontalScrollPolicy is always OFF for ViewStack
+     *  and can't be changed by this setter.
+     */
+    override public function set horizontalScrollPolicy(value:String):void
+    {
+    }
+
+    //----------------------------------
+    //  verticalScrollPolicy
+    //----------------------------------
+
+    [Inspectable(environment="none")]
+
+    /**
+     *  @private
+     *  verticalScrollPolicy is always OFF for ViewStack.
+     */
+    override public function get verticalScrollPolicy():String
+    {
+        return ScrollPolicy.OFF;
+    }
+
+    /**
+     *  @private
+     *  verticalScrollPolicy is always OFF for ViewStack
+     *  and can't be changed by this setter.
+     */
+    override public function set verticalScrollPolicy(value:String):void
+    {
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  contentHeight
+    //----------------------------------
+
+    /**
+     *  The height of the area, in pixels, in which content is displayed.
+     *  You can override this getter if your content
+     *  does not occupy the entire area of the ViewStack container.
+     */
+    protected function get contentHeight():Number
+    {
+        var vm:EdgeMetrics = viewMetricsAndPadding;
+        return unscaledHeight - vm.top - vm.bottom;
+    }
+
+    //----------------------------------
+    //  contentWidth
+    //----------------------------------
+
+    /**
+     *  The width of the area, in pixels, in which content is displayed.
+     *  You can override this getter if your content
+     *  does not occupy the entire area of the ViewStack container.
+     */
+    protected function get contentWidth():Number
+    {
+        var vm:EdgeMetrics = viewMetricsAndPadding;
+        return unscaledWidth - vm.left - vm.right;
+    }
+
+    //----------------------------------
+    //  contentX
+    //----------------------------------
+
+    /**
+     *  The x coordinate of the area of the ViewStack container
+     *  in which content is displayed, in pixels.
+     *  The default value is equal to the value of the
+     *  paddingLeft style property,
+     *  which has a default value of 0.
+     *
+     *  Override the get() method if you do not want
+     *  your content to start layout at x = 0.
+     */
+    protected function get contentX():Number
+    {
+        return getStyle("paddingLeft");
+    }
+
+    //----------------------------------
+    //  contentY
+    //----------------------------------
+
+    /**
+     *  The y coordinate of the area of the ViewStack container
+     *  in which content is displayed, in pixels.
+     *  The default value is equal to the value of the
+     *  paddingTop style property,
+     *  which has a default value of 0.
+     *
+     *  Override the get() method if you do not want
+     *  your content to start layout at y = 0.
+     */
+    protected function get contentY():Number
+    {
+        return getStyle("paddingTop");
+    }
+
+    //----------------------------------
+    //  historyManagementEnabled
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the historyManagementEnabled property.
+     */
+    mx_internal var _historyManagementEnabled:Boolean = false;
+
+    /**
+     *  @private
+     */
+    private var historyManagementEnabledChanged:Boolean = false;
+
+    [Inspectable(defaultValue="true")]
+
+    /**
+     *  If true, enables history management
+     *  within this ViewStack container.
+     *  As the user navigates from one child to another,
+     *  the browser remembers which children were visited.
+     *  The user can then click the browser's Back and Forward buttons
+     *  to move through this navigation history.
+     *
+     *  @default false
+     *
+     *  @see mx.managers.HistoryManager
+     */
+    public function get historyManagementEnabled():Boolean
+    {
+        return _historyManagementEnabled;
+    }
+
+    /**
+     *  @private
+     */
+    public function set historyManagementEnabled(value:Boolean):void
+    {
+        if (value != _historyManagementEnabled)
+        {
+            _historyManagementEnabled = value;
+            historyManagementEnabledChanged = true;
+
+            invalidateProperties();
+        }
+    }
+
+    //----------------------------------
+    //  resizeToContent
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the resizeToContent property.
+     */
+    private var _resizeToContent:Boolean = false;
+
+    /**
+     *  If true, the ViewStack container automatically
+     *  resizes to the size of its current child.
+     *
+     *  @default false
+     */
+    public function get resizeToContent():Boolean
+    {
+        return _resizeToContent;
+    }
+
+    /**
+     *  @private
+     */
+    public function set resizeToContent(value:Boolean):void
+    {
+        if (value != _resizeToContent)
+        {
+            _resizeToContent = value;
+
+            if (value)
+                invalidateSize();
+        }
+    }
+
+    //----------------------------------
+    //  selectedChild
+    //----------------------------------
+
+    [Bindable("valueCommit")]
+
+    /**
+     *  A reference to the currently visible child container.
+     *  The default is a reference to the first child.
+     *  If there are no children, this property is null.
+     *
+     *
Note: You can only set this property in an
+     *  ActionScript statement, not in MXML.

+     */
+    public function get selectedChild():Container
+    {
+        if (selectedIndex == -1)
+            return null;
+
+        return Container(getChildAt(selectedIndex));
+    }
+
+    /**
+     *  @private
+     */
+    public function set selectedChild(
+                            value:Container):void
+    {
+        var newIndex:int = getChildIndex(DisplayObject(value));
+
+        if (newIndex >= 0 && newIndex < numChildren)
+            selectedIndex = newIndex;
+    }
+
+    //----------------------------------
+    //  selectedIndex
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the selectedIndex property.
+     */
+    private var _selectedIndex:int = -1;
+
+    /**
+     *  @private
+     */
+    private var proposedSelectedIndex:int = -1;
+
+    /**
+     *  @private
+     */
+    private var initialSelectedIndex:int = -1;
+
+    [Bindable("change")]
+    [Bindable("valueCommit")]
+    [Inspectable(category="General")]
+
+    /**
+     *  The zero-based index of the currently visible child container.
+     *  Child indexes are in the range 0, 1, 2, ..., n - 1,
+     *  where n is the number of children.
+     *  The default value is 0, corresponding to the first child.
+     *  If there are no children, the value of this property is -1.
+     *
+     *
Note: When you add a new child to a ViewStack
+     *  container, the selectedIndex property is automatically
+     *  adjusted, if necessary, so that the selected child remains selected.

+     */
+    public function get selectedIndex():int
+    {
+        return proposedSelectedIndex == -1 ?
+               _selectedIndex :
+               proposedSelectedIndex;
+    }
+
+    /**
+     *  @private
+     */
+    public function set selectedIndex(value:int):void
+    {
+        // Bail if the index isn't changing.
+        if (value == selectedIndex)
+            return;
+
+        // Propose the specified value as the new value for selectedIndex.
+        // It gets applied later when measure() calls commitSelectedIndex().
+        // The proposed value can be "out of range", because the children
+        // may not have been created yet, so the range check is handled
+        // in commitSelectedIndex(), not here. Other calls to this setter
+        // can change the proposed index before it is committed. Also,
+        // childAddHandler() proposes a value of 0 when it creates the first
+        // child, if no value has yet been proposed.
+        proposedSelectedIndex = value;
+        invalidateProperties();
+
+        // Set a flag which will cause the HistoryManager to save state
+        // the next time measure() is called.
+        if (historyManagementEnabled && _selectedIndex != -1 && !bInLoadState)
+            bSaveState = true;
+
+        dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden methods: UIComponent
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    override protected function commitProperties():void
+    {
+        super.commitProperties();
+
+        if (historyManagementEnabledChanged)
+        {
+            if (historyManagementEnabled)
+                HistoryManager.register(this);
+            else
+                HistoryManager.unregister(this);
+
+            historyManagementEnabledChanged = false;
+        }
+
+        if (proposedSelectedIndex != -1)
+        {
+            commitSelectedIndex(proposedSelectedIndex);
+            proposedSelectedIndex = -1;
+        }
+
+        if (needToInstantiateSelectedChild)
+        {
+            instantiateSelectedChild();
+            needToInstantiateSelectedChild = false;
+        }
+
+        // Dispatch the change event only after the child has been
+        // instantiated.
+        if (dispatchChangeEventPending)
+        {
+            dispatchChangeEvent(lastIndex, selectedIndex);
+            dispatchChangeEventPending = false;
+        }
+
+        if (firstTime)
+        {
+            firstTime = false;
+
+            // Add "addedToStage" and "removedFromStage" listeners so we can
+            // register/un-register from the history manager when this component
+            // is added or removed from the display list.
+            addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler, false, 0, true);
+            addEventListener(Event.REMOVED_FROM_STAGE, removedFromStageHandler, false, 0, true);
+        }
+
+    }
+
+    /**
+     *  Calculates the default sizes and minimum and maximum values of the
+     *  ViewStack container.
+     *  For more information about the measure() method,
+     *  see the UIComponent.measure() method.
+     *
+     *
The default size of a ViewStack container is the default size
+     *  of its currently selected child, plus the padding and borders.
+     *  If the ViewStack container has no children, its default size
+     *  is just large enough for its padding and borders.

+     *
+     *
The minimum size of a ViewStack container is the minimum size
+     *  of its currently selected child, plus the padding and borders.
+     *  If the ViewStack container has no children, its minimum size
+     *  is just large enough for its padding and borders.

+     *
+     *
This method does not change the maximum size of a ViewStack
+     *  container - it remains unbounded.

+     *
+     *  @see mx.core.UIComponent#measure()
+     */
+    override protected function measure():void
+    {
+        super.measure();
+
+        // A ViewStack measures itself based only on its selectedChild.
+        // The minimum, maximum, and preferred sizes are those of the
+        // selected child, plus the borders and margins.
+        var minWidth:Number = 0;
+        var minHeight:Number = 0;
+        var preferredWidth:Number = 0;
+        var preferredHeight:Number = 0;
+
+        // Only measure once.  Thereafter, we'll just use cached values.
+        //
+        // We need to copy the cached values into the measured fields
+        // again to handle the case where scaleX or scaleY is not 1.0.
+        // When the ViewStack is zoomed, code in UIComponent.measureSizes
+        // scales the measuredWidth/Height values every time that
+        // measureSizes is called.  (bug 100749)
+        if (vsPreferredWidth && !_resizeToContent)
+        {
+            measuredMinWidth = vsMinWidth;
+            measuredMinHeight = vsMinHeight;
+            measuredWidth = vsPreferredWidth;
+            measuredHeight = vsPreferredHeight;
+            return;
+        }
+
+        if (numChildren > 0 && selectedIndex != -1)
+        {
+            var child:Container =
+                Container(getChildAt(selectedIndex));
+
+            minWidth = child.minWidth;
+            preferredWidth = child.getExplicitOrMeasuredWidth();
+
+            minHeight = child.minHeight;
+            preferredHeight = child.getExplicitOrMeasuredHeight();
+        }
+
+        var vm:EdgeMetrics = viewMetricsAndPadding;
+
+        var wPadding:Number = vm.left + vm.right;
+        minWidth += wPadding;
+        preferredWidth += wPadding;
+
+        var hPadding:Number = vm.top + vm.bottom;
+        minHeight += hPadding;
+        preferredHeight += hPadding;
+
+        measuredMinWidth = minWidth;
+        measuredMinHeight = minHeight;
+        measuredWidth = preferredWidth;
+        measuredHeight = preferredHeight;
+
+        // If we're called before instantiateSelectedChild, then bail.
+        // We'll be called again later (instantiateSelectedChild calls
+        // invalidateSize), and we don't want to load values into the
+        // cache until we're fully initialized.  (bug 102639)
+        // This check was moved from the beginning of this function to
+        // here to fix bug 103665.
+        if (selectedChild && Container(selectedChild).numChildrenCreated == -1)
+            return;
+
+        // Don't remember sizes if we don't have any children
+        if (numChildren == 0)
+            return;
+
+        vsMinWidth = minWidth;
+        vsMinHeight = minHeight;
+        vsPreferredWidth = preferredWidth;
+        vsPreferredHeight = preferredHeight;
+    }
+
+    /**
+     *  Responds to size changes by setting the positions and sizes
+     *  of this container's children.
+     *  For more information about the updateDisplayList() method,
+     *  see the UIComponent.updateDisplayList() method.
+     *
+     *
Only one of its children is visible at a time, therefore,
+     *  a ViewStack container positions and sizes only that child.

+     *
+     *
The selected child is positioned in the ViewStack container's
+     *  upper-left corner, and allows for the ViewStack container's
+     *  padding and borders.

+     *
+     *
If the selected child has a percentage width or
+     *  height value, it is resized in that direction
+     *  to fill the specified percentage of the ViewStack container's
+     *  content area (i.e., the region inside its padding).

+     *
      *  @param unscaledWidth Specifies the width of the component, in pixels,
      *  in the component's coordinates, regardless of the value of the
      *  scaleX property of the component.
@@ -808,501 +806,496 @@
      *  @param unscaledHeight Specifies the height of the component, in pixels,
      *  in the component's coordinates, regardless of the value of the
      *  scaleY property of the component.
-	 *
-	 *  @see mx.core.UIComponent#updateDisplayList()
-	 */
-	override protected function updateDisplayList(unscaledWidth:Number,
-												  unscaledHeight:Number):void
-	{
-		super.updateDisplayList(unscaledWidth, unscaledHeight);
-
-		var nChildren:int = numChildren;
-		var w:Number = contentWidth;
-		var h:Number = contentHeight;
-		var left:Number = contentX;
-		var top:Number = contentY;
-
-		// Stretch the selectedIndex to fill our size
-		if (selectedIndex != -1)
-		{
-			var child:Container =
-				Container(getChildAt(selectedIndex));
-
-			var newWidth:Number = w;
-			var newHeight:Number = h;
-
-			if (!isNaN(child.percentWidth))
-			{
-				if (newWidth > child.maxWidth)
-					newWidth = child.maxWidth;
-			}
-			else
-			{
-				if (newWidth > child.explicitWidth)
-					newWidth = child.explicitWidth;
-			}
-
-			if (!isNaN(child.percentHeight))
-			{
-				if (newHeight > child.maxHeight)
-					newHeight = child.maxHeight;
-			}
-			else
-			{
-				if (newHeight > child.explicitHeight)
-					newHeight = child.explicitHeight;
-			}
-
-			// Don't send events for the size/move. The set visible below
-			if (child.width != newWidth || child.height != newHeight)
-				child.setActualSize(newWidth, newHeight);
-			if (child.x != left || child.y != top)
-				child.move(left, top);
-
-			// Now that the child is properly sized and positioned it
-			// can be shown.
-			child.visible = true;
-		}
-	}
-
-	/**
-	 *  @private
-	 *  When asked to create an overlay mask, create it on the selected child
-	 *  instead. That way, the chrome around the edge of the ViewStack
-	 *  (e.g. the tabs in a TabNavigator) is not occluded by the overlay mask
-	 *  (Bug 99029)
-	 */
-	override mx_internal function addOverlay(color:uint,
-										targetArea:RoundedRectangle = null):void
-	{
-		// As we're switching the currently-selected child, don't
-		// allow two children to both have an overlay at the same time.
-		// This is done because it makes accounting a headache.  If there's
-		// a legitimate reason why two children both need overlays, this
-		// restriction could be relaxed.
-		if (overlayChild)
-			removeOverlay();
-
-		// Remember which child has an overlay, so that we don't inadvertently
-		// create an overlay on one child and later try to remove the overlay
-		// of another child. (bug 100731)
-		overlayChild = selectedChild;
-		if (!overlayChild)
-			return;
-
-		overlayColor = color;
-		overlayTargetArea = targetArea;
-
-		if (selectedChild &&
-			selectedChild.numChildrenCreated == -1)
-			// No children have been created
-		{
-			// Wait for the childrenCreated event before creating the overlay
-			selectedChild.addEventListener(FlexEvent.INITIALIZE,
-										   initializeHandler);
-		}
-		else // Children already exist
-		{
-			initializeHandler(null);
-		}
-	}
-
-	/**
-	 *  @private
-	 */
-	override mx_internal function removeOverlay():void
-	{
-		if (overlayChild)
-		{
-			UIComponent(overlayChild).removeOverlay();
-			overlayChild = null;
-		}
-	}
-
-	//--------------------------------------------------------------------------
-	//
-	//  Overridden methods: Container
-	//
-	//--------------------------------------------------------------------------
-
-	/**
-	 *  @private
-	 */
-	override mx_internal function setActualCreationPolicies(policy:String):void
-	{
-		super.setActualCreationPolicies(policy);
-
-		// If the creation policy is switched to ContainerCreationPolicy.ALL
-		// and our createComponentsFromDescriptors() method has already been
-		// called (we've created our children but not all our grandchildren),
-		// then create all our grandchildren now. (Bug 99160)
-		if (policy == ContainerCreationPolicy.ALL && numChildren > 0)
-		{
-			for (var i:int = 0; i < numChildren; i++)
-			{
-				var containerChild:Container =
-					getChildAt(i) as Container;
-
-				if (containerChild && containerChild.numChildrenCreated == -1)
-					containerChild.createComponentsFromDescriptors();
-			}
-		}
-	}
-
-	/**
-	 *  @private
-	 */
-	override public function createComponentsFromDescriptors(
-									recurse:Boolean = true):void
-	{
-		// The easiest way to handle the ContainerCreationPolicy.ALL policy
-		// is to let Container's implementation of
-		// createComponentsFromDescriptors() handle it.
-		if (actualCreationPolicy == ContainerCreationPolicy.ALL)
-		{
-			super.createComponentsFromDescriptors();
-			return;
-		}
-
-		// If the policy is ContainerCreationPolicy.AUTO, ViewStack
-		// instantiates its children immediately, but not any grandchildren.
-		// The children of the selected child will get created in
-		// instantiateSelectedChild().
-		// Why not create the grandchildren of the selected child by calling
-		//    createComponentFromDescriptor(childDescriptors[i],
-		//                                  i == selectedIndex);
-		// in the loop below? Because one of this ViewStacks's childDescriptors
-		// may be for a Repeater, in which case the following loop over the
-		// childDescriptors is not the same as a loop over the children.
-		// In particular, selectedIndex is supposed to specify the nth
-		// child, not the nth childDescriptor, and the 2nd parameter of
-		// createComponentFromDescriptor() should make the recursion happen
-		// on the nth child, not the nth childDescriptor.
-		var numChildrenBefore:int = numChildren;
-		var n:int = childDescriptors ? childDescriptors.length : 0;
-		for (var i:int = 0; i < n; i++)
-		{
-			createComponentFromDescriptor(childDescriptors[i], false);
-		}
-
-		numChildrenCreated = numChildren - numChildrenBefore;
-
-		processedDescriptors = true;
-	}
-
-	//--------------------------------------------------------------------------
-	//
-	//  Methods: IHistoryManagerClient
-	//
-	//--------------------------------------------------------------------------
-
-	/**
-	 *  @copy mx.managers.IHistoryManagerClient#saveState()
-	 */
-	public function saveState():Object
-	{
-		var index:int = _selectedIndex == -1 ? 0 : _selectedIndex;
-		return { selectedIndex: index };
-	}
-
-	/**
-	 *  @copy mx.managers.IHistoryManagerClient#loadState()
-	 */
-	public function loadState(state:Object):void
-	{
-		var newIndex:int = state ? int(state.selectedIndex) : 0;
-
-		if (newIndex == -1)
-			newIndex = initialSelectedIndex;
-
-		if (newIndex == -1)
-			newIndex = 0;
-
-		if (newIndex != _selectedIndex)
-		{
-			// When loading a new state, we don't want to
-			// save our current state in the history stack.
-			bInLoadState = true;
-			selectedIndex = newIndex;
-			bInLoadState = false;
-		}
-	}
-
-	//--------------------------------------------------------------------------
-	//
-	//  Methods
-	//
-	//--------------------------------------------------------------------------
-
-	/**
-	 *  Commits the selected index. This function is called during the commit
-	 *  properties phase when the selectedIndex (or selectedItem) property
-	 *  has changed.
-	 */
-	protected function commitSelectedIndex(newIndex:int):void
-	{
-		// The selectedIndex must be -1 if there are no children,
-		// even if a selectedIndex has been proposed.
-		if (numChildren == 0)
-		{
-			_selectedIndex = -1;
-			return;
-		}
-
-		// If there are children, ensure that the new index is in bounds.
-		if (newIndex < 0)
-			newIndex = 0;
-		else if (newIndex > numChildren - 1)
-			newIndex = numChildren - 1;
-
-		// Stop all currently playing effects
-		if (lastIndex != -1 && lastIndex < numChildren)
-			Container(getChildAt(lastIndex)).endEffectsStarted();
-
-		if (_selectedIndex != -1)
-			selectedChild.endEffectsStarted();
-
-		// Remember the old index.
-		lastIndex = _selectedIndex;
-
-		// Bail if the index isn't changing.
-		if (newIndex == lastIndex)
-			return;
-
-		// Commit the new index.
-		_selectedIndex = newIndex;
-
-		// Remember our initial selected index so we can
-		// restore to our default state when the history
-		// manager requests it.
-		if (initialSelectedIndex == -1)
-			initialSelectedIndex = _selectedIndex;
-
-		// Only dispatch a change event if we're going to and from
-		// a valid index
-		if (lastIndex != -1 && newIndex != -1)
-			dispatchChangeEventPending = true;
-
-		var listenForEffectEnd:Boolean = false;
-
-		if (lastIndex != -1 && lastIndex < numChildren)
-		{
-			var currentChild:Container = Container(getChildAt(lastIndex));
-
-			currentChild.setVisible(false); // Hide the current child
-
-			if (currentChild.getStyle("hideEffect"))
-			{
-				var hideEffect:Effect = EffectManager.lastEffectCreated; // This should be the hideEffect
-
-				if (hideEffect)
-				{
-					hideEffect.addEventListener(EffectEvent.EFFECT_END, hideEffectEndHandler);
-					listenForEffectEnd = true;
-				}
-			}
-		}
-
-		// If we don't have to wait for a hide effect to finish
-		if (!listenForEffectEnd)
-			hideEffectEndHandler(null);
-	}
-
-	private function hideEffectEndHandler(event:EffectEvent):void
-	{
-		if (event)
-			event.currentTarget.removeEventListener(EffectEvent.EFFECT_END, hideEffectEndHandler);
-
-		// Give any change handlers a chance to act before we
-		// instantiate our pane (which eats up all the processing cycles)
-		needToInstantiateSelectedChild = true;
-		invalidateProperties();
-
-		if (bSaveState)
-		{
-			HistoryManager.save();
-			bSaveState = false;
-		}
-	}
-
-	/**
-	 *  @private
-	 */
-	private function instantiateSelectedChild():void
-	{
-		if (!selectedChild)
-			return;
-
-		// Performance optimization: don't call createComponents if we know
-		// that createComponents has already been called.
-		if (selectedChild && selectedChild.numChildrenCreated == -1)
-		{
-			if (initialized)  // Only listen if the ViewStack has already been initialized.
-				selectedChild.addEventListener(FlexEvent.CREATION_COMPLETE,childCreationCompleteHandler);
-			selectedChild.createComponentsFromDescriptors(true);
-		}
-
-		// Do the initial measurement/layout pass for the
-		// newly-instantiated descendants.
-
-		if (selectedChild is IInvalidating)
-			IInvalidating(selectedChild).invalidateSize();
-
-		invalidateSize();
-		invalidateDisplayList();
-	}
-
-	/**
-	 *  @private
-	 */
-	private function dispatchChangeEvent(oldIndex:int, newIndex:int):void
-	{
-		var event:IndexChangedEvent =
-			new IndexChangedEvent(IndexChangedEvent.CHANGE);
-		event.oldIndex = oldIndex;
-		event.newIndex = newIndex;
-		event.relatedObject = getChildAt(newIndex);
+     *
+     *  @see mx.core.UIComponent#updateDisplayList()
+     */
+    override protected function updateDisplayList(unscaledWidth:Number,
+                                                  unscaledHeight:Number):void
+    {
+        super.updateDisplayList(unscaledWidth, unscaledHeight);
+
+        var nChildren:int = numChildren;
+        var w:Number = contentWidth;
+        var h:Number = contentHeight;
+        var left:Number = contentX;
+        var top:Number = contentY;
+
+        // Stretch the selectedIndex to fill our size
+        if (selectedIndex != -1)
+        {
+            var child:Container =
+                Container(getChildAt(selectedIndex));
+
+            var newWidth:Number = w;
+            var newHeight:Number = h;
+
+            if (!isNaN(child.percentWidth))
+            {
+                if (newWidth > child.maxWidth)
+                    newWidth = child.maxWidth;
+            }
+            else
+            {
+                if (newWidth > child.explicitWidth)
+                    newWidth = child.explicitWidth;
+            }
+
+            if (!isNaN(child.percentHeight))
+            {
+                if (newHeight > child.maxHeight)
+                    newHeight = child.maxHeight;
+            }
+            else
+            {
+                if (newHeight > child.explicitHeight)
+                    newHeight = child.explicitHeight;
+            }
+
+            // Don't send events for the size/move. The set visible below
+            if (child.width != newWidth || child.height != newHeight)
+                child.setActualSize(newWidth, newHeight);
+            if (child.x != left || child.y != top)
+                child.move(left, top);
+
+            // Now that the child is properly sized and positioned it
+            // can be shown.
+            child.visible = true;
+        }
+    }
+
+    /**
+     *  @private
+     *  When asked to create an overlay mask, create it on the selected child
+     *  instead. That way, the chrome around the edge of the ViewStack
+     *  (e.g. the tabs in a TabNavigator) is not occluded by the overlay mask
+     *  (Bug 99029)
+     */
+    override mx_internal function addOverlay(color:uint,
+                                        targetArea:RoundedRectangle = null):void
+    {
+        // As we're switching the currently-selected child, don't
+        // allow two children to both have an overlay at the same time.
+        // This is done because it makes accounting a headache.  If there's
+        // a legitimate reason why two children both need overlays, this
+        // restriction could be relaxed.
+        if (overlayChild)
+            removeOverlay();
+
+        // Remember which child has an overlay, so that we don't inadvertently
+        // create an overlay on one child and later try to remove the overlay
+        // of another child. (bug 100731)
+        overlayChild = selectedChild;
+        if (!overlayChild)
+            return;
+
+        overlayColor = color;
+        overlayTargetArea = targetArea;
+
+        if (selectedChild &&
+            selectedChild.numChildrenCreated == -1)
+            // No children have been created
+        {
+            // Wait for the childrenCreated event before creating the overlay
+            selectedChild.addEventListener(FlexEvent.INITIALIZE,
+                                           initializeHandler);
+        }
+        else // Children already exist
+        {
+            initializeHandler(null);
+        }
+    }
+
+    /**
+     *  @private
+     */
+    override mx_internal function removeOverlay():void
+    {
+        if (overlayChild)
+        {
+            UIComponent(overlayChild).removeOverlay();
+            overlayChild = null;
+        }
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden methods: Container
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    override mx_internal function setActualCreationPolicies(policy:String):void
+    {
+        super.setActualCreationPolicies(policy);
+
+        // If the creation policy is switched to ContainerCreationPolicy.ALL
+        // and our createComponentsFromDescriptors() method has already been
+        // called (we've created our children but not all our grandchildren),
+        // then create all our grandchildren now. (Bug 99160)
+        if (policy == ContainerCreationPolicy.ALL && numChildren > 0)
+        {
+            for (var i:int = 0; i < numChildren; i++)
+            {
+                var containerChild:Container =
+                    getChildAt(i) as Container;
+
+                if (containerChild && containerChild.numChildrenCreated == -1)
+                    containerChild.createComponentsFromDescriptors();
+            }
+        }
+    }
+
+    /**
+     *  @private
+     */
+    override public function createComponentsFromDescriptors(
+                                    recurse:Boolean = true):void
+    {
+        // The easiest way to handle the ContainerCreationPolicy.ALL policy
+        // is to let Container's implementation of
+        // createComponentsFromDescriptors() handle it.
+        if (actualCreationPolicy == ContainerCreationPolicy.ALL)
+        {
+            super.createComponentsFromDescriptors();
+            return;
+        }
+
+        // If the policy is ContainerCreationPolicy.AUTO, ViewStack
+        // instantiates its children immediately, but not any grandchildren.
+        // The children of the selected child will get created in
+        // instantiateSelectedChild().
+        // Why not create the grandchildren of the selected child by calling
+        //    createComponentFromDescriptor(childDescriptors[i],
+        //                                  i == selectedIndex);
+        // in the loop below? Because one of this ViewStacks's childDescriptors
+        // may be for a Repeater, in which case the following loop over the
+        // childDescriptors is not the same as a loop over the children.
+        // In particular, selectedIndex is supposed to specify the nth
+        // child, not the nth childDescriptor, and the 2nd parameter of
+        // createComponentFromDescriptor() should make the recursion happen
+        // on the nth child, not the nth childDescriptor.
+        var numChildrenBefore:int = numChildren;
+        var n:int = childDescriptors ? childDescriptors.length : 0;
+        for (var i:int = 0; i < n; i++)
+        {
+            createComponentFromDescriptor(childDescriptors[i], false);
+        }
+
+        numChildrenCreated = numChildren - numChildrenBefore;
+
+        processedDescriptors = true;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods: IHistoryManagerClient
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @copy mx.managers.IHistoryManagerClient#saveState()
+     */
+    public function saveState():Object
+    {
+        var index:int = _selectedIndex == -1 ? 0 : _selectedIndex;
+        return { selectedIndex: index };
+    }
+
+    /**
+     *  @copy mx.managers.IHistoryManagerClient#loadState()
+     */
+    public function loadState(state:Object):void
+    {
+        var newIndex:int = state ? int(state.selectedIndex) : 0;
+
+        if (newIndex == -1)
+            newIndex = initialSelectedIndex;
+
+        if (newIndex == -1)
+            newIndex = 0;
+
+        if (newIndex != _selectedIndex)
+        {
+            // When loading a new state, we don't want to
+            // save our current state in the history stack.
+            bInLoadState = true;
+            selectedIndex = newIndex;
+            bInLoadState = false;
+        }
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Commits the selected index. This function is called during the commit
+     *  properties phase when the selectedIndex (or selectedItem) property
+     *  has changed.
+     */
+    protected function commitSelectedIndex(newIndex:int):void
+    {
+        // The selectedIndex must be -1 if there are no children,
+        // even if a selectedIndex has been proposed.
+        if (numChildren == 0)
+        {
+            _selectedIndex = -1;
+            return;
+        }
+
+        // If there are children, ensure that the new index is in bounds.
+        if (newIndex < 0)
+            newIndex = 0;
+        else if (newIndex > numChildren - 1)
+            newIndex = numChildren - 1;
+
+        // Stop all currently playing effects
+        if (lastIndex != -1 && lastIndex < numChildren)
+            Container(getChildAt(lastIndex)).endEffectsStarted();
+
+        if (_selectedIndex != -1)
+            selectedChild.endEffectsStarted();
+
+        // Remember the old index.
+        lastIndex = _selectedIndex;
+
+        // Bail if the index isn't changing.
+        if (newIndex == lastIndex)
+            return;
+
+        // Commit the new index.
+        _selectedIndex = newIndex;
+
+        // Remember our initial selected index so we can
+        // restore to our default state when the history
+        // manager requests it.
+        if (initialSelectedIndex == -1)
+            initialSelectedIndex = _selectedIndex;
+
+        // Only dispatch a change event if we're going to and from
+        // a valid index
+        if (lastIndex != -1 && newIndex != -1)
+            dispatchChangeEventPending = true;
+
+        var listenForEffectEnd:Boolean = false;
+
+        if (lastIndex != -1 && lastIndex < numChildren)
+        {
+            var currentChild:Container = Container(getChildAt(lastIndex));
+
+            currentChild.setVisible(false); // Hide the current child
+
+            if (currentChild.getStyle("hideEffect"))
+            {
+                var hideEffect:Effect = EffectManager.lastEffectCreated; // This should be the hideEffect
+
+                if (hideEffect)
+                {
+                    hideEffect.addEventListener(EffectEvent.EFFECT_END, hideEffectEndHandler);
+                    listenForEffectEnd = true;
+                }
+            }
+        }
+
+        // If we don't have to wait for a hide effect to finish
+        if (!listenForEffectEnd)
+            hideEffectEndHandler(null);
+    }
+
+    private function hideEffectEndHandler(event:EffectEvent):void
+    {
+        if (event)
+            event.currentTarget.removeEventListener(EffectEvent.EFFECT_END, hideEffectEndHandler);
+
+        // Give any change handlers a chance to act before we
+        // instantiate our pane (which eats up all the processing cycles)
+        needToInstantiateSelectedChild = true;
+        invalidateProperties();
+
+        if (bSaveState)
+        {
+            HistoryManager.save();
+            bSaveState = false;
+        }
+    }
+
+    /**
+     *  @private
+     */
+    private function instantiateSelectedChild():void
+    {
+        if (!selectedChild)
+            return;
+
+        // Performance optimization: don't call createComponents if we know
+        // that createComponents has already been called.
+        if (selectedChild && selectedChild.numChildrenCreated == -1)
+        {
+            if (initialized)  // Only listen if the ViewStack has already been initialized.
+                selectedChild.addEventListener(FlexEvent.CREATION_COMPLETE,childCreationCompleteHandler);
+            selectedChild.createComponentsFromDescriptors(true);
+        }
+
+        // Do the initial measurement/layout pass for the
+        // newly-instantiated descendants.
+
+        if (selectedChild is IInvalidating)
+            IInvalidating(selectedChild).invalidateSize();
+
+        invalidateSize();
+        invalidateDisplayList();
+    }
+
+    /**
+     *  @private
+     */
+    private function dispatchChangeEvent(oldIndex:int, newIndex:int):void
+    {
+        var event:IndexChangedEvent =
+            new IndexChangedEvent(IndexChangedEvent.CHANGE);
+        event.oldIndex = oldIndex;
+        event.newIndex = newIndex;
+        event.relatedObject = getChildAt(newIndex);
         dispatchEvent(event);
-	}
-
-	//--------------------------------------------------------------------------
-	//
-	//  Event handlers
-	//
-	//--------------------------------------------------------------------------
-
-	/**
-	 *  @private
-	 *  Handles "added" event from system manager
-	 */
-	private function systemManager_addedHandler(event:Event):void
-	{
-		if (event.target is DisplayObjectContainer &&
-				DisplayObjectContainer(event.target).contains(this))
-		{
-			if (historyManagementEnabled)
-				HistoryManager.register(this);
-		}
-	}
-
-	/**
-	 *  @private
-	 *  Handles "removed" event from system manager
-	 */
-	private function systemManager_removedHandler(event:Event):void
-	{
-		if (event.target is DisplayObjectContainer &&
-				DisplayObjectContainer(event.target).contains(this))
-			HistoryManager.unregister(this);
-	}
-
-	/**
-	 *  @private
-	 *  Called when we are running a Dissolve effect
-	 *  and the initialize event has been dispatched
-	 *  or the children already exist
-	 */
-	private function initializeHandler(event:FlexEvent):void
-	{
-		overlayChild.removeEventListener(FlexEvent.INITIALIZE,
-										 initializeHandler);
-
-		UIComponent(overlayChild).addOverlay(overlayColor, overlayTargetArea);
-	}
-
-	/**
-	 *  @private
-	 *  Handles when the new selectedChild has finished being created.
-	 */
-	private function childCreationCompleteHandler(event:FlexEvent):void
-	{
-		event.target.removeEventListener(FlexEvent.CREATION_COMPLETE,childCreationCompleteHandler);
-		event.target.dispatchEvent(new FlexEvent(FlexEvent.SHOW));
-
-	}
-
-	/**
-	 *  @private
-	 */
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Event handlers
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Handles "addedToStage" event
+     */
+    private function addedToStageHandler(event:Event):void
+    {
+        if (historyManagementEnabled)
+                HistoryManager.register(this);
+    }
+
+    /**
+     *  @private
+     *  Handles "removedFromStage" event
+     */
+    private function removedFromStageHandler(event:Event):void
+    {
+        HistoryManager.unregister(this);
+    }
+
+    /**
+     *  @private
+     *  Called when we are running a Dissolve effect
+     *  and the initialize event has been dispatched
+     *  or the children already exist
+     */
+    private function initializeHandler(event:FlexEvent):void
+    {
+        overlayChild.removeEventListener(FlexEvent.INITIALIZE,
+                                         initializeHandler);
+
+        UIComponent(overlayChild).addOverlay(overlayColor, overlayTargetArea);
+    }
+
+    /**
+     *  @private
+     *  Handles when the new selectedChild has finished being created.
+     */
+    private function childCreationCompleteHandler(event:FlexEvent):void
+    {
+        event.target.removeEventListener(FlexEvent.CREATION_COMPLETE,childCreationCompleteHandler);
+        event.target.dispatchEvent(new FlexEvent(FlexEvent.SHOW));
+
+    }
+
+    /**
+     *  @private
+     */
     private function childAddHandler(event:ChildExistenceChangedEvent):void
-	{
-		var child:DisplayObject = event.relatedObject;
-		var index:int = getChildIndex(child);
-
-		if (child is IUIComponent)
-		{
-			var uiChild:IUIComponent = IUIComponent(child);
-			// ViewStack creates all of its children initially invisible.
-			// They are made as they become the selected child.
-			uiChild.visible = false;
-		}
-
-		// If we just created the first child and no selected index has
-		// been proposed, then propose this child to be selected.
-		if (numChildren == 1 && proposedSelectedIndex == -1)
-		{
-			proposedSelectedIndex = 0;
-			invalidateProperties();
-		}
-		else if (index <= _selectedIndex && numChildren > 1)
-		{
-			selectedIndex++;
-		}
-
-		if (child as IAutomationObject);
-			IAutomationObject(child).showInAutomationHierarchy = true;
-
-	}
-
-	/**
-	 *  @private
-	 *  When a child is removed, adjust the selectedIndex such that the current
-	 *  child remains selected; or if the current child was removed, then the
-	 *  next (or previous) child gets automatically selected; when the last
-	 *  remaining child is removed, the selectedIndex is set to -1.
-	 */
-	private function childRemoveHandler(event:ChildExistenceChangedEvent):void
-	{
-		var child:DisplayObject = event.relatedObject;
-		var index:int = getChildIndex(child);
-
-		// Handle the simple case.
-		if (index > selectedIndex)
-			return;
-
-		var currentSelectedIndex:int = selectedIndex;
-
-		// This matches one of the two conditions:
-		// 1. a view before the current was deleted, or
-		// 2. the current view was deleted and it was also
-		//    at the end of the stack.
-		// In both cases, we need to decrement selectedIndex.
-		if (index < currentSelectedIndex ||
-			currentSelectedIndex == (numChildren - 1))
-		{
-			// If the selectedIndex was already 0, it should go to -1.
-			// -1 is a special value; in order to avoid runtime errors
-			// in various methods, we need to skip the range checking in
-			// commitSelectedIndex() and set _selectedIndex explicitly here.
-			if (currentSelectedIndex == 0)
-			{
-				selectedIndex = -1;
-				_selectedIndex = -1;
-			}
-			else
-			{
-				selectedIndex--;
-			}
-		}
-		else if (index == currentSelectedIndex)
-		{
-			// If we're deleting the currentSelectedIndex and there is another
-			// child after it, it will become the new selected child so we
-			// need to make sure it is instantiated.
-			needToInstantiateSelectedChild = true;
-			invalidateProperties();
-		}
-	}
+    {
+        var child:DisplayObject = event.relatedObject;
+        var index:int = getChildIndex(child);
+
+        if (child is IUIComponent)
+        {
+            var uiChild:IUIComponent = IUIComponent(child);
+            // ViewStack creates all of its children initially invisible.
+            // They are made as they become the selected child.
+            uiChild.visible = false;
+        }
+
+        // If we just created the first child and no selected index has
+        // been proposed, then propose this child to be selected.
+        if (numChildren == 1 && proposedSelectedIndex == -1)
+        {
+            proposedSelectedIndex = 0;
+            invalidateProperties();
+        }
+        else if (index <= _selectedIndex && numChildren > 1)
+        {
+            selectedIndex++;
+        }
+
+        if (child as IAutomationObject);
+            IAutomationObject(child).showInAutomationHierarchy = true;
+
+    }
+
+    /**
+     *  @private
+     *  When a child is removed, adjust the selectedIndex such that the current
+     *  child remains selected; or if the current child was removed, then the
+     *  next (or previous) child gets automatically selected; when the last
+     *  remaining child is removed, the selectedIndex is set to -1.
+     */
+    private function childRemoveHandler(event:ChildExistenceChangedEvent):void
+    {
+        var child:DisplayObject = event.relatedObject;
+        var index:int = getChildIndex(child);
+
+        // Handle the simple case.
+        if (index > selectedIndex)
+            return;
+
+        var currentSelectedIndex:int = selectedIndex;
+
+        // This matches one of the two conditions:
+        // 1. a view before the current was deleted, or
+        // 2. the current view was deleted and it was also
+        //    at the end of the stack.
+        // In both cases, we need to decrement selectedIndex.
+        if (index < currentSelectedIndex ||
+            currentSelectedIndex == (numChildren - 1))
+        {
+            // If the selectedIndex was already 0, it should go to -1.
+            // -1 is a special value; in order to avoid runtime errors
+            // in various methods, we need to skip the range checking in
+            // commitSelectedIndex() and set _selectedIndex explicitly here.
+            if (currentSelectedIndex == 0)
+            {
+                selectedIndex = -1;
+                _selectedIndex = -1;
+            }
+            else
+            {
+                selectedIndex--;
+            }
+        }
+        else if (index == currentSelectedIndex)
+        {
+            // If we're deleting the currentSelectedIndex and there is another
+            // child after it, it will become the new selected child so we
+            // need to make sure it is instantiated.
+            needToInstantiateSelectedChild = true;
+            invalidateProperties();
+        }
+    }
 }

 }
+


Transferred from the Adobe Open Source Subversion Repository

Revision: 10814
Author:   cframpto@adobe.com
Date:     2009-10-02T15:45:31.406572Z

Log Message:
-----------
Added selectionActivePosition and selectionAnchorPosition to ITextInput interface.  Renamed params of selectRange to anchorPosition and activePosition from anchorIndex and activeIndex to be consistent.

Make sure the SwatchPanel gets the textInputClass style from either itself or passed down from its parent ColorPicker.as

When changing the text in the SwatchPanel, need to save the selection and restore it after setting the text since TLF does not preserve the selection.

In TLFText.css added missing textFieldClass style to ColorPicker and ComboBox.  Also added style for s|TLFTextInput skinClass to ensure the spark TextInput skin is pulled in if this theme is used (spark default.css may not be in the path).

QE notes: need to compile TLFText with -theme+="TLFText.css" now rather than theme="TLFText.css"
Doc notes:
Bugs: SDK-22935, SDK-23548
Reviewer: Gordon
Tests run: checkintests
Is noteworthy for integration: no

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/ColorPicker.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/ITextInput.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/colorPickerClasses/SwatchPanel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/TextInput.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/TLFText.css</path>

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

--- frameworks/projects/mx/src/mx/controls/ColorPicker.as
+++ frameworks/projects/mx/src/mx/controls/ColorPicker.as
@@ -1168,6 +1168,7 @@
             dropdownSwatch.showTextField = showTextField;
             dropdownSwatch.selectedColor = selectedColor;
             dropdownSwatch.selectedIndex = selectedIndex;
+            dropdownSwatch.textInputClass = getStyle("textInputClass");

             var swatchPanelStyleName:Object = getStyle("swatchPanelStyleName");
             if (swatchPanelStyleName)


把另一处 callback 也改成其他名字

把另一处 callback 也改成其他名字

--- as3/com/netease/protobuf/SimpleWebRPC.as
+++ as3/com/netease/protobuf/SimpleWebRPC.as
@@ -19,7 +19,7 @@
 		private static const REF:Dictionary = new Dictionary();
 		public function send(qualifiedMethodName:String,
 							 input:IExternalizable,
-							 callback:Function,
+							 rpcResult:Function,
 							 outputType:Class):void {

 			const loader:URLLoader = new URLLoader
@@ -29,11 +29,11 @@
 				delete REF[loader]
 				const output:IExternalizable = new outputType
 				output.readExternal(loader.data)
-				callback(output)
+				rpcResult(output)
 			})
 			function errorEventHandler(event:Event):void {
 				delete REF[loader]
-				callback(event)
+				rpcResult(event)
 			}
 			loader.addEventListener(IOErrorEvent.IO_ERROR, errorEventHandler)
 			loader.addEventListener(


Transferred from the Adobe Open Source Subversion Repository

Revision: 5101
Author:   gauravj@adobe.com
Date:     2009-02-27T05:22:45.887116Z

Log Message:
-----------
Update action script files with asdoc version tags.

QE Notes: None.
Doc Notes: Please review and update as necessary.
tests: checkintests

Modified Paths:
--------------
663 paths were modified

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

--- frameworks/projects/mx/src/mx/events/SliderEvent.as
+++ frameworks/projects/mx/src/mx/events/SliderEvent.as
@@ -24,6 +24,11 @@
  *  @see mx.controls.VSlider
  *  @see mx.controls.sliderClasses.Slider
  *  @see mx.events.SliderEventClickTarget
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
  */
 public class SliderEvent extends Event
 {
@@ -65,6 +70,11 @@
      *

      *
      *  @eventType change
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public static const CHANGE:String = "change";

@@ -98,6 +108,11 @@
      *

      *
      *  @eventType thumbDrag
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public static const THUMB_DRAG:String = "thumbDrag";

@@ -131,6 +146,11 @@
      *

      *
      *  @eventType thumbPress
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public static const THUMB_PRESS:String = "thumbPress";

@@ -164,6 +184,11 @@
      *

      *
      *  @eventType thumbRelease
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public static const THUMB_RELEASE:String = "thumbRelease";

@@ -197,6 +222,11 @@
      *
      *  @param keyCode If the event was triggered by a key press,
      *  the keycode for the key.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public function SliderEvent(type:String, bubbles:Boolean = false,
                                 cancelable:Boolean = false,
@@ -230,6 +260,11 @@
      *  or SliderEventClickTarget.TRACK.
      *
      *  @see mx.events.SliderEventClickTarget
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public var clickTarget:String;

@@ -239,6 +274,11 @@

     /**
      *  If the event was triggered by a key press, the keycode for the key.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public var keyCode:int;

@@ -250,6 +290,11 @@
      *  The zero-based index of the thumb whose position has changed.
      *  If there is only a single thumb, the value is 0.
      *  If there are two thumbs, the value is 0 or 1.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public var thumbIndex:int;

@@ -261,6 +306,11 @@
      *  Indicates the type of input action.
      *  The value is either InteractionInputType.MOUSE
      *  or InteractionInputType.KEYBOARD.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public var triggerEvent:Event;

@@ -270,6 +320,11 @@

     /**
      *  The new value of the slider.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public var value:Number;


Fixed a bug with the getGeometriesFromRecordKey which wouldn't
properly handle the return value of getValueFromKey().

Tested with kyle.xml by reproducing this error:
1) Load World Borders into map tool
2) Quickly try a reprojection and probe of the geometries.

Change-Id: Ifa610bb245b4129086537a8b0f8b6f65f3380cd0

--- WeaveUI/src/weave/visualization/plotters/GeometryPlotter.as
+++ WeaveUI/src/weave/visualization/plotters/GeometryPlotter.as
@@ -112,8 +112,20 @@

 		public function getGeometriesFromRecordKey(recordKey:IQualifiedKey, minImportance:Number = 0, bounds:IBounds2D = null):Array
 		{
-			var geoms:Array = geometryColumn.getValueFromKey(recordKey);
-			return geoms;
+			var value:* = geometryColumn.getValueFromKey(recordKey);
+			var geoms:Array = null;
+
+			if (value is Array)
+				geoms = value;
+			else if (value is GeneralizedGeometry)
+				geoms [ value as GeneralizedGeometry ];
+
+			var results = [];
+			if (geoms != null)
+				for each (var geom:GeneralizedGeometry in geoms)
+					results.push(geom);
+
+			return results;
 		}

 		/**


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

--- frameworks/projects/framework/src/mx/core/FlexBitmap.as
+++ frameworks/projects/framework/src/mx/core/FlexBitmap.as
@@ -1,3 +1,13 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 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.core
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 3044
Author:   smgilson@adobe.com
Date:     2008-08-29T17:03:13.869368Z

Log Message:
-----------
Fix invalid HTML in ASDoc comment

Checkin Test Passed: Yes
QA: No
Bug:
Doc: No

Modified Paths:
--------------
/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/FlexLoader.as

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

--- frameworks/projects/framework/src/mx/core/FlexLoader.as
+++ frameworks/projects/framework/src/mx/core/FlexLoader.as
@@ -25,72 +25,73 @@
 {
     include "../core/Version.as";

-	//--------------------------------------------------------------------------
-	//
-	//  Constructor
-	//
-	//--------------------------------------------------------------------------
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------

     /**
      *  Constructor.
-	 *
-	 *
Sets the name property to a string
-	 *  returned by the createUniqueName()
-	 *  method of the mx.utils.NameUtils class.

-	 *  This string is the name of the object's class concatenated
-	 *  with an integer that is unique within the application,
-	 *  such as "FlexLoader13".

-	 *
-	 *  @see flash.display.DisplayObject#name
-	 *  @see mx.utils.NameUtils#createUniqueName()
+     *
+     *
Sets the name property to a string
+     *  returned by the createUniqueName()
+     *  method of the mx.utils.NameUtils class.

+     *
+     *
This string is the name of the object's class concatenated
+     *  with an integer that is unique within the application,
+     *  such as "FlexLoader13".

+     *
+     *  @see flash.display.DisplayObject#name
+     *  @see mx.utils.NameUtils#createUniqueName()
      */
     public function FlexLoader()
-	{
-		super();
+    {
+        super();

-		try
-		{
-			name = NameUtil.createUniqueName(this);
-		}
-		catch(e:Error)
-		{
-			// The name assignment above can cause the RTE
-			//   Error #2078: The name property of a Timeline-placed
-			//   object cannot be modified.
-			// if this class has been associated with an asset
-			// that was created in the Flash authoring tool.
-			// The only known case where this is a problem is when
-			// an asset has another asset PlaceObject'd onto it and
-			// both are embedded separately into a Flex application.
-			// In this case, we ignore the error and toString() will
-			// use the name assigned in the Flash authoring tool.
-		}
-	}
+        try
+        {
+            name = NameUtil.createUniqueName(this);
+        }
+        catch(e:Error)
+        {
+            // The name assignment above can cause the RTE
+            //   Error #2078: The name property of a Timeline-placed
+            //   object cannot be modified.
+            // if this class has been associated with an asset
+            // that was created in the Flash authoring tool.
+            // The only known case where this is a problem is when
+            // an asset has another asset PlaceObject'd onto it and
+            // both are embedded separately into a Flex application.
+            // In this case, we ignore the error and toString() will
+            // use the name assigned in the Flash authoring tool.
+        }
+    }

-	//--------------------------------------------------------------------------
-	//
-	//  Overridden methods
-	//
-	//--------------------------------------------------------------------------
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden methods
+    //
+    //--------------------------------------------------------------------------

     /**
-	 *  Returns a string indicating the location of this object
-	 *  within the hierarchy of DisplayObjects in the Application.
-	 *  This string, such as "MyApp0.HBox5.FlexLoader13",
-	 *  is built by the displayObjectToString() method
-	 *  of the mx.utils.NameUtils class from the name
-	 *  property of the object and its ancestors.
-	 *
-	 *  @return A String indicating the location of this object
-	 *  within the DisplayObject hierarchy.
-	 *
-	 *  @see flash.display.DisplayObject#name
-	 *  @see mx.utils.NameUtils#displayObjectToString()
+     *  Returns a string indicating the location of this object
+     *  within the hierarchy of DisplayObjects in the Application.
+     *  This string, such as "MyApp0.HBox5.FlexLoader13",
+     *  is built by the displayObjectToString() method
+     *  of the mx.utils.NameUtils class from the name
+     *  property of the object and its ancestors.
+     *
+     *  @return A String indicating the location of this object
+     *  within the DisplayObject hierarchy.
+     *
+     *  @see flash.display.DisplayObject#name
+     *  @see mx.utils.NameUtils#displayObjectToString()
      */
     override public function toString():String
-	{
-		return NameUtil.displayObjectToString(this);
-	}
+    {
+        return NameUtil.displayObjectToString(this);
+    }
 }

 }


Transferred from the Adobe Open Source Subversion Repository

Revision: 3707
Author:   gpburch@adobe.com
Date:     2008-10-17T16:53:57.363767Z

Log Message:
-----------
Renamed AddItems::addItemsToArrayCollection and AddItems::removeItemsFromArrayCollection to AddItems::addItemsToIList and AddItems::addItemsToIList respectively. Also removed references to Container and replaced them with IChildList.  Lastly I cleaned up the imports by removing unused ones and organizing them.

QE: No
Doc: No
Checkintests: Pass
Reviewer: Corey L.
Bugs: None.

Modified Paths:
--------------
/flex/sdk/trunk/frameworks/projects/flex4/src/mx/states/AddItems.as

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

--- frameworks/projects/framework/src/mx/states/AddItems.as
+++ frameworks/projects/framework/src/mx/states/AddItems.as
@@ -12,15 +12,14 @@
 package mx.states
 {
 import flash.display.DisplayObject;
+
+import mx.collections.IList;
 import mx.components.FxContainer;
 import mx.components.Group;
-import mx.collections.IList;
-import mx.core.Container;
 import mx.core.ContainerCreationPolicy;
+import mx.core.IChildList;
 import mx.core.IDeferredInstance;
 import mx.core.UIComponent;
-import mx.states.IOverride;
-import mx.states.OverrideBase;

 [DefaultProperty("itemsFactory")]

@@ -384,13 +383,13 @@
         {
             addItemsToContentHolder(dest, localItems);
         }
-        else if (propertyName == null && dest is Container)
-        {
-            addItemsToContainer(dest as Container, localItems);
+        else if (propertyName == null && dest is IChildList)
+        {
+            addItemsToContainer(dest as IChildList, localItems);
         }
         else if (propertyName != null && !isStyle && dest[propertyName] is IList)
         {
-            addItemsToArrayCollection(dest[propertyName], localItems);
+            addItemsToIList(dest[propertyName], localItems);
         }
         else
         {
@@ -425,14 +424,14 @@
             for (i = 0; i < numAdded; i++)
                 dest.removeItemAt(startIndex);
         }
-        else if (propertyName == null && dest is Container)
+        else if (propertyName == null && dest is IChildList)
         {
             for (i = 0; i < numAdded; i++)
-                Container(dest).removeChildAt(startIndex);
+                IChildList(dest).removeChildAt(startIndex);
         }
         else if (propertyName != null && !isStyle && dest[propertyName] is IList)
         {
-            removeItemsFromArrayCollection(dest[propertyName] as IList);
+            removeItemsFromIList(dest[propertyName] as IList);
         }
         else
         {
@@ -464,8 +463,8 @@
             if (propertyName == null && (dest is Group || dest is FxContainer))
                 return dest.getItemIndex(object);

-            if (propertyName == null && dest is Container)
-                return Container(dest).getChildIndex(DisplayObject(object));
+            if (propertyName == null && dest is IChildList)
+                return IChildList(dest).getChildIndex(DisplayObject(object));

             if (propertyName != null && !isStyle && dest[propertyName] is IList)
                 return IList(dest[propertyName].list).getItemIndex(object);
@@ -480,7 +479,7 @@
     }

     /**
-     * @private
+     * @private
      * Find the index of the relative object. If relativeTo is an array,
      * search for the first valid item's index.  This is used for stateful
      * documents where one or more relative siblings of the newly inserted
@@ -520,7 +519,7 @@
     /**
      *  @private
      */
-    protected function addItemsToContainer(dest:Container, items:Array):void
+    protected function addItemsToContainer(dest:IChildList, items:Array):void
     {
         if (startIndex == -1)
             startIndex = dest.numChildren;
@@ -548,7 +547,7 @@
     /**
      *  @private
      */
-    protected function addItemsToArrayCollection(list:IList, items:Array):void
+    protected function addItemsToIList(list:IList, items:Array):void
     {
         if (startIndex == -1)
             startIndex = list.length;
@@ -560,7 +559,7 @@
     /**
      *  @private
      */
-    protected function removeItemsFromArrayCollection(list:IList):void
+    protected function removeItemsFromIList(list:IList):void
     {
         for (var i:int = 0; i < numAdded; i++)
             list.removeItemAt(startIndex);


Transferred from the Adobe Open Source Subversion Repository

Revision: 9427
Author:   egeorgie@adobe.com
Date:     2009-08-20T20:04:22.377902Z

Log Message:
-----------
Update the DragManagerImpl.as to support scaled/transformed lists.

QE notes: Add a test for dragging from a scaled List.
Doc notes: None
Bugs: None
Reviewer: Glenn, Jason
Tests run: checkintests, mustella (managers/DragManager)
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Group.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/listClasses/ListBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/DragManagerImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/dragClasses/DragProxy.as</path>

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

--- frameworks/projects/spark/src/spark/components/Group.as
+++ frameworks/projects/spark/src/spark/components/Group.as
@@ -1452,8 +1452,7 @@

         return false;
     }
-
-
+
     /**
      *  @private
      *


Transferred from the Adobe Open Source Subversion Repository

Revision: 7836
Author:   chaase@adobe.com
Date:     2009-06-15T14:37:21.379918Z

Log Message:
-----------
PARB changes for effects. This includes various property renames, a couple of class renames, moving 3 classes to a sub-package, and various doc cleanups. This also includes changing a handful of Array properties to typed Vectors.

QE: This breaks Mustella due to the renames
Doc: Docs will need to be updated to reflect the changes as well
Bugs: None
Reviewer: Jason
Tests: checkintests, Thermo's transitionbug test

Modified Paths:
--------------
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/utils/BitmapUtil.as</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/MotionPath.as" copyfrom-rev="7748" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/animation/MotionPath.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/easing/Power.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/easing/EasingFraction.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/KeyFrame.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/interpolation/RGBInterpolator.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/interpolation/HSBInterpolator.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/CallAction.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimateColor.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/Animate.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/FadeInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/animation/RepeatBehavior.as</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimateShaderTransition.as" copyfrom-rev="7748" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimateTransitionShader.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimateShaderTransition.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/spark-manifest.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/Slider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/interpolation/IInterpolator.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/interpolation/NumberInterpolator.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/ScrollBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/Rotate3D.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/Scale.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/CallActionInstance.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/SimpleMotionPath.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/AnimateColorInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/AnimateInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/animation/Animation.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/Rotate.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/AnimateShaderTransitionInstance.as</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/AnimateShaderTransitionInstance.as" copyfrom-rev="7748" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/AnimateTransitionShaderInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/Wipe.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/easing/Sine.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/Move.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/interpolation/ArrayInterpolator.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/CrossFade.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimateTransform.as</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/SimpleMotionPath.as" copyfrom-rev="7748" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/animation/SimpleMotionPath.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/utils/HSBColor.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/animation/IAnimationTarget.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/easing/Linear.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/ResizeInstance.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/animation/Keyframe.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/CrossFade.pbk</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/MotionPath.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/WipeInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/AnimateTransformInstance.as</path>

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

--- frameworks/projects/spark/src/spark/utils/BitmapUtil.as
+++ frameworks/projects/spark/src/spark/utils/BitmapUtil.as
@@ -0,0 +1,71 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2008 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package spark.utils
+{
+import flash.display.BitmapData;
+import flash.display.IBitmapDrawable;
+import flash.display.Sprite;
+import flash.geom.Matrix;
+import flash.geom.Rectangle;
+
+import mx.core.IUIComponent;
+
+/**
+ *  This class provides bitmap-related utility functions
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ */
+public class BitmapUtil
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Creates a BitmapData representation of the target object.
+     *
+     *  @param target The object to capture in the resulting BitmapData
+     *
+     *  @return A BitmapData object containing the image.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public static function getSnapshot(target:IUIComponent):BitmapData
+    {
+        var topLevel:Sprite = Sprite(IUIComponent(target).systemManager);
+        var rectBounds:Rectangle = target.getBounds(topLevel);
+        var m:Matrix = target.transform.concatenatedMatrix;
+        // truncate position because the fractional offset will already be figured
+        // into the filter placement onto the target.
+        // TODO (chaase): There are still some offset
+        // problems with objects inside of rotated parents, depending on the angle.
+        if (m)
+            m.translate(-(Math.floor(rectBounds.x)), -(Math.floor(rectBounds.y)));
+        var bmData:BitmapData = new BitmapData(rectBounds.width,
+            rectBounds.height, true, 0);
+        bmData.draw(IBitmapDrawable(target), m);
+
+        return bmData;
+    }
+
+}
+}