Transferred from the Adobe Open Source Subversion Repository

Revision: 6182
Author:   jimurphy@adobe.com
Date:     2009-04-21T17:17:58.392301Z

Log Message:
-----------
Merge 3.x revisions 5830,5880,5891,5992,6136 -> trunk

Modified Paths:
--------------
<path kind="dir" action="M">/flex/sdk/trunk</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/utils/LoaderUtil.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/MessageAgent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/ChannelSet.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/mx/controls/FlexNativeMenu.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/SWFLoader.as</path>

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

--- frameworks/projects/airframework/src/mx/controls/FlexNativeMenu.as
+++ frameworks/projects/airframework/src/mx/controls/FlexNativeMenu.as
@@ -11,34 +11,34 @@

 package mx.controls
 {
-    import flash.display.InteractiveObject;
-    import flash.display.NativeMenu;
-    import flash.display.NativeMenuItem;
-    import flash.display.Stage;
-    import flash.events.Event;
-    import flash.events.EventDispatcher;
-    import flash.events.TimerEvent;
-    import flash.ui.Keyboard;
-    import flash.utils.Timer;
-    import flash.xml.XMLNode;
-
-    import mx.collections.ArrayCollection;
-    import mx.collections.ICollectionView;
-    import mx.collections.XMLListCollection;
-    import mx.collections.errors.ItemPendingError;
-    import mx.controls.menuClasses.IMenuDataDescriptor;
-    import mx.controls.treeClasses.DefaultDataDescriptor;
-    import mx.core.Application;
-    import mx.core.EventPriority;
-    import mx.core.UIComponent;
-    import mx.core.UIComponentGlobals;
-    import mx.core.mx_internal;
-    import mx.events.CollectionEvent;
-    import mx.events.CollectionEventKind;
-    import mx.events.FlexNativeMenuEvent;
-    import mx.managers.ILayoutManagerClient;
-    import mx.managers.ISystemManager;
-
+	import flash.display.InteractiveObject;
+	import flash.display.NativeMenu;
+	import flash.display.NativeMenuItem;
+	import flash.display.Stage;
+	import flash.events.Event;
+	import flash.events.EventDispatcher;
+	import flash.events.TimerEvent;
+	import flash.ui.Keyboard;
+	import flash.utils.Timer;
+	import flash.xml.XMLNode;
+
+	import mx.collections.ArrayCollection;
+	import mx.collections.ICollectionView;
+	import mx.collections.XMLListCollection;
+	import mx.collections.errors.ItemPendingError;
+	import mx.controls.menuClasses.IMenuDataDescriptor;
+	import mx.controls.treeClasses.DefaultDataDescriptor;
+	import mx.core.Application;
+	import mx.core.EventPriority;
+	import mx.core.UIComponent;
+	import mx.core.UIComponentGlobals;
+	import mx.core.mx_internal;
+	import mx.events.CollectionEvent;
+	import mx.events.CollectionEventKind;
+	import mx.events.FlexNativeMenuEvent;
+	import mx.managers.ILayoutManagerClient;
+	import mx.managers.ISystemManager;
+
 //--------------------------------------
 //  Events
 //--------------------------------------
@@ -47,10 +47,6 @@
  *  Dispatched before a menu or submenu is displayed.
  *
  *  @eventType mx.events.FlexNativeMenuEvent.MENU_SHOW
- *
- *  @langversion 3.0
- *  @playerversion AIR 1.1
- *  @productversion Flex 3
  */
 [Event(name="menuShow", type="mx.events.FlexNativeMenuEvent")]

@@ -58,10 +54,6 @@
  *  Dispatched when a menu item is selected.
  *
  *  @eventType mx.events.FlexNativeMenuEvent.ITEM_CLICK
- *
- *  @langversion 3.0
- *  @playerversion AIR 1.1
- *  @productversion Flex 3
  */
 [Event(name="itemClick", type="mx.events.FlexNativeMenuEvent")]

@@ -247,10 +239,7 @@
  *  @see flash.display.NativeMenu
  *  @see mx.events.FlexNativeMenuEvent
  *
- *
- *  @langversion 3.0
  *  @playerversion AIR 1.1
- *  @productversion Flex 3
  */
 public class FlexNativeMenu extends EventDispatcher implements ILayoutManagerClient, IFlexContextMenu
 {
@@ -266,10 +255,6 @@
      *  The character to use to indicate the mnemonic index in a label.  By
      *  default, it is the underscore character, so in "C_ut", u would become
      *  the character for the mnemonic index.
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     private static var MNEMONIC_INDEX_CHARACTER:String = "_";

@@ -281,10 +266,6 @@

     /**
      *  Constructor.
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     public function FlexNativeMenu()
     {
@@ -300,139 +281,123 @@
     //--------------------------------------------------------------------------

     //--------------------------------------------------------------------------
-    //
-    //  Properties: ILayoutManagerClient
-    //
-    //--------------------------------------------------------------------------
-
-    //----------------------------------
-    //  initialized
-    //----------------------------------
-
-    /**
-     *  @private
-     *  Storage for the initialized property.
-     */
-    private var _initialized:Boolean = false;
-
-    /**
-     *  @copy mx.core.UIComponent#initialized
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
+	//
+	//  Properties: ILayoutManagerClient
+	//
+	//--------------------------------------------------------------------------
+
+	//----------------------------------
+	//  initialized
+	//----------------------------------
+
+    /**
+	 *  @private
+	 *  Storage for the initialized property.
+	 */
+	private var _initialized:Boolean = false;
+
+    /**
+	 *  @copy mx.core.UIComponent#initialized
      */
     public function get initialized():Boolean
-    {
-        return _initialized;
-    }
+	{
+		return _initialized;
+	}

     /**
      *  @private
      */
     public function set initialized(value:Boolean):void
-    {
-        _initialized = value;
-    }
+	{
+		_initialized = value;
+	}

     //----------------------------------
     //  nestLevel
     //----------------------------------

     /**
-     *  @private
-     *  Storage for the nestLevel property.
-     */
-    private var _nestLevel:int = 1;
-
-    // no one will likely set nestLevel (but there's a setter in case
-    // someone wants to.  We default nestLevel to 1 as it's a top-level
-    // component that goes in the chrome.
-
-    /**
+	 *  @private
+	 *  Storage for the nestLevel property.
+	 */
+	private var _nestLevel:int = 1;
+
+	// no one will likely set nestLevel (but there's a setter in case
+	// someone wants to.  We default nestLevel to 1 as it's a top-level
+	// component that goes in the chrome.
+
+	/**
      *  @copy mx.core.UIComponent#nestLevel
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function get nestLevel():int
-    {
-        return _nestLevel;
-    }
-
-    /**
-     *  @private
-     */
-    public function set nestLevel(value:int):void
-    {
-        _nestLevel = value;
-
-        // After nestLevel is initialized, add this object to the
-        // LayoutManager's queue, so that it is drawn at least once
-        invalidateProperties();
-    }
-
-    //----------------------------------
-    //  processedDescriptors
-    //----------------------------------
-
-    /**
-     *  @private
-     *  Storage for the processedDescriptors property.
-     */
-    private var _processedDescriptors:Boolean = false;
+     */
+	public function get nestLevel():int
+	{
+		return _nestLevel;
+	}
+
+	/**
+     *  @private
+     */
+	public function set nestLevel(value:int):void
+	{
+		_nestLevel = value;
+
+		// After nestLevel is initialized, add this object to the
+		// LayoutManager's queue, so that it is drawn at least once
+		invalidateProperties();
+	}
+
+	//----------------------------------
+	//  processedDescriptors
+	//----------------------------------
+
+    /**
+     *  @private
+	 *  Storage for the processedDescriptors property.
+     */
+	private var _processedDescriptors:Boolean = false;

     /**
      *  @copy mx.core.UIComponent#processedDescriptors
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     public function get processedDescriptors():Boolean
-    {
-        return _processedDescriptors;
-    }
+	{
+		return _processedDescriptors;
+	}

     /**
      *  @private
      */
     public function set processedDescriptors(value:Boolean):void
-    {
-        _processedDescriptors = value;
-    }
-
-    //----------------------------------
-    //  updateCompletePendingFlag
-    //----------------------------------
-
-    /**
-     *  @private
-     *  Storage for the updateCompletePendingFlag property.
-     */
-    private var _updateCompletePendingFlag:Boolean = false;
-
-    /**
-     *  A flag that determines if an object has been through all three phases
-     *  of layout validation (provided that any were required).
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
+	{
+		_processedDescriptors = value;
+	}
+
+	//----------------------------------
+	//  updateCompletePendingFlag
+	//----------------------------------
+
+    /**
+     *  @private
+	 *  Storage for the updateCompletePendingFlag property.
+     */
+	private var _updateCompletePendingFlag:Boolean = false;
+
+    /**
+	 *  A flag that determines if an object has been through all three phases
+	 *  of layout validation (provided that any were required).
      */
     public function get updateCompletePendingFlag():Boolean
-    {
-        return _updateCompletePendingFlag;
-    }
+	{
+		return _updateCompletePendingFlag;
+	}

     /**
      *  @private
      */
     public function set updateCompletePendingFlag(value:Boolean):void
-    {
-        _updateCompletePendingFlag = value;
-    }
+	{
+		_updateCompletePendingFlag = value;
+	}

     //--------------------------------------------------------------------------
     //
@@ -452,7 +417,7 @@
      */
     private var _nativeMenu:NativeMenu = new NativeMenu();

-    [Bindable("nativeMenuChange")]
+    [Bindable("nativeMenuUpdate")]

     //----------------------------------
     //  nativeMenu
@@ -463,23 +428,19 @@
       *  or null if there is not one.
       *
       *  Any changes made directly to the underlying NativeMenu instance
-      *  may be lost when changes are made to the menu or the underlying
-      *  data provider.
-      *
-      *  @langversion 3.0
-      *  @playerversion AIR 1.1
-      *  @productversion Flex 3
+	  *  may be lost when changes are made to the menu or the underlying
+	  *  data provider.
       */
-    public function get nativeMenu() : NativeMenu
-    {
-        return _nativeMenu;
-    }
-
-    //----------------------------------
+	public function get nativeMenu() : NativeMenu
+	{
+		return _nativeMenu;
+	}
+
+	//----------------------------------
     //  dataDescriptor
     //----------------------------------

-    /**
+	/**
      *  @private
      */
     private var dataDescriptorChanged:Boolean = false;
@@ -516,10 +477,6 @@
      *
      *
The default value is an internal instance of the
      *  DefaultDataDescriptor class.

-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     public function get dataDescriptor():IMenuDataDescriptor
     {
@@ -535,12 +492,12 @@

         dataDescriptorChanged = true;
     }
-
-    //----------------------------------
+
+	//----------------------------------
     //  dataProvider
     //----------------------------------

-    /**
+	/**
      *  @private
      */
     private var dataProviderChanged:Boolean = false;
@@ -556,11 +513,11 @@

     /**
      *  The hierarchy of objects that are used to define the structure
-     *  of menu items in the NativeMenu. Individual data objects define
-     *  menu items, and items with child items become menus and submenus.
+	 *  of menu items in the NativeMenu. Individual data objects define
+	 *  menu items, and items with child items become menus and submenus.
      *
      *
The FlexNativeMenu control handles the source data object as follows:

-     *
+	 *
      *

      *
A String containing valid XML text is converted to an XML object.

      *
An XMLNode is converted to an XML object.

@@ -573,10 +530,6 @@
      *

      *
      *  @default "undefined"
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     public function get dataProvider():Object
     {
@@ -662,10 +615,6 @@

     /**
      *  @copy mx.controls.Menu#hasRoot
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     public function get hasRoot():Boolean
     {
@@ -676,7 +625,7 @@
     //  keyEquivalentField
     //----------------------------------

-    /**
+	/**
      *  @private
      */
     private var keyEquivalentFieldChanged:Boolean = false;
@@ -692,17 +641,13 @@
     /**
      *  The name of the field in the data provider that determines the
      *  key equivalent for each menu item.  The set of values is defined
-     *  in the Keyboard class, in the KEYNAME_XXXX constants. For example,
-     *  consult that list for the value for a control character such as Home, Insert, etc.
+	 *  in the Keyboard class, in the KEYNAME_XXXX constants. For example,
+	 *  consult that list for the value for a control character such as Home, Insert, etc.
      *
      *
Setting the keyEquivalentFunction property causes this property to be ignored.

      *
      *  @default "keyEquivalent"
      *  @see flash.ui.Keyboard
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     public function get keyEquivalentField():String
     {
@@ -749,15 +694,11 @@
      *
      *
The key equivalent function must take a single argument, which is the item
      *  in the data provider, and must return a String.

-     *
+	 *
      *
myKeyEquivalentFunction(item:Object):String

      *
      *  @default "undefined"
      *  @see flash.ui.Keyboard
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     public function get keyEquivalentFunction():Function
     {
@@ -784,7 +725,7 @@
     //  keyEquivalentModifiersFunction
     //----------------------------------

-    /**
+	/**
      *  @private
      */
     private var keyEquivalentModifiersFunctionChanged:Boolean = false;
@@ -793,47 +734,47 @@
      *  @private
      */
     private var _keyEquivalentModifiersFunction:Function = keyEquivalentModifiersDefaultFunction;
-
+
     private function keyEquivalentModifiersDefaultFunction(data:Object):Array
-    {
-        var modifiers:Array = [];
-        var xmlModifiers:Array = ["@altKey", "@cmdKey", "@ctrlKey",
-                                  "@shiftKey", "@commandKey", "@controlKey"];
-        var objectModifiers:Array = ["altKey", "cmdKey", "ctrlKey",
-                                     "shiftKey", "commandKey", "controlKey"];
+	{
+		var modifiers:Array = [];
+		var xmlModifiers:Array = ["@altKey", "@cmdKey", "@ctrlKey",
+		                          "@shiftKey", "@commandKey", "@controlKey"];
+		var objectModifiers:Array = ["altKey", "cmdKey", "ctrlKey",
+		                             "shiftKey", "commandKey", "controlKey"];
         var keyboardModifiers:Array = [Keyboard.ALTERNATE, Keyboard.COMMAND,
                                        Keyboard.CONTROL, Keyboard.SHIFT,
                                        Keyboard.COMMAND, Keyboard.CONTROL];
-
-        if (data is XML)
-        {
-            for (var i:int = 0; i < xmlModifiers.length; i++)
-            {
-                try
-                {
-                    var modifier:* = data[xmlModifiers[i]];
-                    if (modifier[0] == true)
-                        modifiers.push(keyboardModifiers[i]);
-                }
-                catch(e:Error)
-                {
-                }
-            }
+
+		if (data is XML)
+        {
+        	for (var i:int = 0; i < xmlModifiers.length; i++)
+        	{
+        		try
+	            {
+	            	var modifier:* = data[xmlModifiers[i]];
+		            if (modifier[0] == true)
+		                modifiers.push(keyboardModifiers[i]);
+	            }
+	            catch(e:Error)
+	            {
+	            }
+        	}
         }
         else if (data is Object)
         {
             for (i = 0; i < objectModifiers.length; i++)
-            {
-                try
-                {
-                    modifier = data[objectModifiers[i]];
-                    if (String(modifier).toLowerCase() == "true")
-                        modifiers.push(keyboardModifiers[i]);
-                }
-                catch(e:Error)
-                {
-                }
-            }
+        	{
+        		try
+	            {
+	            	modifier = data[objectModifiers[i]];
+		            if (String(modifier).toLowerCase() == "true")
+		                modifiers.push(keyboardModifiers[i]);
+	            }
+	            catch(e:Error)
+	            {
+	            }
+        	}
         }

         return modifiers;
@@ -847,22 +788,18 @@
      *
      *  If you omit this property, Flex uses its own default function to determine the
      *  Array of modifiers by looking in the data provider data for the presence of
-     *  the following (boolean) fields: altKey, commandKey,
-     *  controlKey, and shiftKey.
+	 *  the following (boolean) fields: altKey, commandKey,
+	 *  controlKey, and shiftKey.
      *
      *
The keyEquivalentModifiersFunction property is good for handling
      *  formatting, localization, and platform independence.

      *
      *
The key equivalent modifiers function must take a single argument, which
      *  is the item in the data provider, and must return an array of modifier key names.

-     *
+	 *
      *
myKeyEquivalentModifiersFunction(item:Object):Array

      *
      *  @default "undefined"
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     public function get keyEquivalentModifiersFunction():Function
     {
@@ -889,7 +826,7 @@
     //  labelField
     //----------------------------------

-    /**
+	/**
      *  @private
      */
     private var labelFieldChanged:Boolean = false;
@@ -908,26 +845,22 @@
      *  Strings, Flex uses each string value as the label. If the data
      *  provider is an E4X XML object, you must set this property explicitly.
      *  For example, if each XML elementin an E4X XML Object includes a "label"
-     *  attribute containing the text to display for each menu item, set
-     *  the labelField to "@label".
+	 *  attribute containing the text to display for each menu item, set
+	 *  the labelField to "@label".
      *
      *
In a label, you can specify the character to be used as the mnemonic index
      *  by preceding it with an underscore. For example, a label value of "C_ut"
-     *  sets the mnemonic index to 1. Only the first underscore present is used for this
-     *  purpose.  To display a literal underscore character in the label, you can escape it
-     *  using a double underscore. For example, a label value of "C__u_t" would
-     *  result in a menu item with the label "C_ut" and a mnemonic index of 3 (the "t"
-     *  character). If the field defined in the mnemonicIndexField property
-     *  is present and set to a value greater than zero, that value takes precedence over
-     *  any underscore-specified mnemonic index value.

+	 *  sets the mnemonic index to 1. Only the first underscore present is used for this
+	 *  purpose.  To display a literal underscore character in the label, you can escape it
+	 *  using a double underscore. For example, a label value of "C__u_t" would
+	 *  result in a menu item with the label "C_ut" and a mnemonic index of 3 (the "t"
+	 *  character). If the field defined in the mnemonicIndexField property
+	 *  is present and set to a value greater than zero, that value takes precedence over
+	 *  any underscore-specified mnemonic index value.

      *
      *
Setting the labelFunction property causes this property to be ignored.

      *
      *  @default "label"
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     public function get labelField():String
     {
@@ -977,14 +910,10 @@
      *
      *
The label function must take a single argument, which is the item
      *  in the data provider, and must return a String.

-     *
+	 *
      *
myLabelFunction(item:Object):String

      *
      *  @default "undefined"
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     public function get labelFunction():Function
     {
@@ -1011,7 +940,7 @@
     //  mnemonicIndexField
     //----------------------------------

-    /**
+	/**
      *  @private
      */
     private var mnemonicIndexFieldChanged:Boolean = false;
@@ -1029,19 +958,15 @@
      *  mnemonic index for each menu item.
      *
      *
If the field specified by this property contains a number greater
-     *  than zero, that mnemonic index
+	 *  than zero, that mnemonic index
      *  takes precedence over one specified by an underscore in the label.

      *
      *
Setting the mnemonicIndexFunction property causes
-     *  this property to be ignored.

+	 *  this property to be ignored.

      *
      *  @default "mnemonicIndex"
-     *
-     *  @see #labelField
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
+	 *
+	 *  @see #labelField
      */
     public function get mnemonicIndexField():String
     {
@@ -1085,7 +1010,7 @@
      *  property value.

      *
      *
If this property is defined and the function returns a number greater than
-     *  zero for a data item, the returned mnemonic index
+	 *  zero for a data item, the returned mnemonic index
      *  takes precedence over one specified by an underscore in the label.

      *
      *
The mnemonicIndexFunction property is good for handling formatting,
@@ -1093,14 +1018,10 @@
      *
      *
The mnemonic index function must take a single argument which is the item
      *  in the data provider and return an int.

-     *
+	 *
      *
myMnemonicIndexFunction(item:Object):int

      *
      *  @default "undefined"
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     public function get mnemonicIndexFunction():Function
     {
@@ -1146,17 +1067,13 @@
      *
      *
If the data provider has a root node, and the showRoot property
      *  is set to false, the top-level menu items displayed by the
-     *  FlexNativeMenu control correspond to the immediate descendants of the root node.

+	 *  FlexNativeMenu control correspond to the immediate descendants of the root node.

      *
      *
This flag has no effect when using a data provider without a root nodes,
      *  such as a List or Array.

      *
      *  @default true
      *  @see #hasRoot
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     public function get showRoot():Boolean
     {
@@ -1181,31 +1098,27 @@
     //  Methods
     //
     //--------------------------------------------------------------------------
-
-    /**
-     *  @copy mx.core.UIComponent#invalidateProperties()
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
+
+   	/**
+	 *  @copy mx.core.UIComponent#invalidateProperties()
+	 */
     public function invalidateProperties():void
     {
         // Don't try to add the object to the display list queue until we've
-        // been assigned a nestLevel, or we'll get added at the wrong place in
-        // the LayoutManager's priority queue.
-        if (!invalidatePropertiesFlag && nestLevel > 0)
-        {
-            invalidatePropertiesFlag = true;
-            if (UIComponentGlobals.mx_internal::layoutManager)
-                UIComponentGlobals.mx_internal::layoutManager.invalidateProperties(this);
-            else
-            {
-                var myTimer:Timer = new Timer(100, 1);
-                myTimer.addEventListener(TimerEvent.TIMER, validatePropertiesTimerHandler);
-                myTimer.start();
-            }
-        }
+		// been assigned a nestLevel, or we'll get added at the wrong place in
+		// the LayoutManager's priority queue.
+		if (!invalidatePropertiesFlag && nestLevel > 0)
+		{
+			invalidatePropertiesFlag = true;
+			if (UIComponentGlobals.mx_internal::layoutManager)
+				UIComponentGlobals.mx_internal::layoutManager.invalidateProperties(this);
+			else
+			{
+				var myTimer:Timer = new Timer(100, 1);
+				myTimer.addEventListener(TimerEvent.TIMER, validatePropertiesTimerHandler);
+				myTimer.start();
+			}
+		}
     }

     /**
@@ -1218,10 +1131,6 @@

     /**
      *  @inheritDoc
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     public function validateProperties():void
     {
@@ -1235,10 +1144,6 @@

     /**
      *  @inheritDoc
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     public function validateSize(recursive:Boolean = false):void
     {
@@ -1246,76 +1151,52 @@

     /**
      *  @inheritDoc
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     public function validateDisplayList():void
     {
     }

     /**
-     *  Validates and updates the properties and layout of this object
-     *  and redraws it, if necessary.
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function validateNow():void
-    {
-        // Since we don't have commit/measure/layout phases,
-        // all we need to do here is the commit phase
-        if (invalidatePropertiesFlag)
-            validateProperties();
-    }
-
-    /**
-     *  Sets the context menu of the InteractiveObject to the underlying native menu.
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function setContextMenu(component:InteractiveObject):void
-    {
-        component.contextMenu = nativeMenu;
-
-        if (component is Application)
-        {
-            var systemManager:ISystemManager = Application(component).systemManager;
-
-            if (systemManager is InteractiveObject)
-                InteractiveObject(systemManager).contextMenu = nativeMenu;
-        }
-
-        component.dispatchEvent(new Event("flexContextMenuChanged"));
-    }
-
-    /**
-     *  Unsets the context menu of the InteractiveObject that has been set to
-     *  the underlying native menu.
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function unsetContextMenu(component:InteractiveObject):void
-    {
-        component.contextMenu = null;
-
-        component.dispatchEvent(new Event("flexContextMenuChanged"));
-    }
+	 *  Validates and updates the properties and layout of this object
+	 *  and redraws it, if necessary.
+	 */
+	public function validateNow():void
+	{
+		// Since we don't have commit/measure/layout phases,
+		// all we need to do here is the commit phase
+		if (invalidatePropertiesFlag)
+			validateProperties();
+	}
+
+	/**
+	 *  Sets the context menu of the InteractiveObject to the underlying native menu.
+	 */
+	public function setContextMenu(component:InteractiveObject):void
+	{
+		component.contextMenu = nativeMenu;
+
+		if (component is Application)
+		{
+			var systemManager:ISystemManager = Application(component).systemManager;
+
+			if (systemManager is InteractiveObject)
+        		InteractiveObject(systemManager).contextMenu = nativeMenu;
+		}
+	}
+
+	/**
+	 *  Unsets the context menu of the InteractiveObject that has been set to
+	 *  the underlying native menu.
+	 */
+	public function unsetContextMenu(component:InteractiveObject):void
+	{
+		component.contextMenu = null;
+	}

     /**
      *  Processes the properties set on the component.
-     *
-     *  @see mx.core.UIComponent#commitProperties()
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
+	 *
+	 *  @see mx.core.UIComponent#commitProperties()
      */
     protected function commitProperties():void
     {
@@ -1326,7 +1207,7 @@
         }

         if (dataProviderChanged ||showRootChanged ||
-            labelFieldChanged || dataDescriptorChanged)
+        	labelFieldChanged || dataDescriptorChanged)
         {
             var tmpCollection:ICollectionView;

@@ -1366,7 +1247,7 @@
                                                false,
                                                EventPriority.DEFAULT_HANDLER, true);

-                populateMenu(_nativeMenu, tmpCollection);
+             	populateMenu(_nativeMenu, tmpCollection);
             }

             dispatchEvent(new Event("nativeMenuChange"));
@@ -1395,10 +1276,10 @@
     private function clearMenu(menu:NativeMenu):void
     {
         var numItems:int = menu.numItems;
-        for (var i:int = 0; i < numItems; i++)
-        {
-            menu.removeItemAt(0);
-        }
+    	for (var i:int = 0; i < numItems; i++)
+    	{
+    		menu.removeItemAt(0);
+    	}
     }

     /**
@@ -1438,94 +1319,86 @@
             return;
         }

-        var type:String = dataDescriptor.getType(data).toLowerCase();
-        var isSeparator:Boolean = (type == "separator");
-
-        // label changes later, but separator is read-only so need to know here
-        var nativeMenuItem:NativeMenuItem = new NativeMenuItem("", isSeparator);
-
-        if (!isSeparator)
-        {
-            // enabled
-            nativeMenuItem.enabled = dataDescriptor.isEnabled(data);
-
-            // checked
-            nativeMenuItem.checked = type == "check" && dataDescriptor.isToggled(data);
-
-            // data
-            nativeMenuItem.data = dataDescriptor.getData(data, mx_internal::_rootModel);
-
-            // key equivalent
-            nativeMenuItem.keyEquivalent = itemToKeyEquivalent(data);
-
-            // key equivalent modifiers
-            nativeMenuItem.keyEquivalentModifiers = itemToKeyEquivalentModifiers(data);
-
-            // label and mnemonic index
-            var labelData:String = itemToLabel(data);
-            var mnemonicIndex:int = itemToMnemonicIndex(data);
-
-            if (mnemonicIndex >= 0)
-            {
-                nativeMenuItem.label = parseLabelToString(labelData);
-                nativeMenuItem.mnemonicIndex = mnemonicIndex;
-            }
-            else
-            {
-                nativeMenuItem.label = parseLabelToString(labelData);
-                nativeMenuItem.mnemonicIndex = parseLabelToMnemonicIndex(labelData);
-            }
-
-            // event listeners
-            nativeMenuItem.addEventListener(flash.events.Event.SELECT, itemSelectHandler, false, 0, true);
-
-            // recursive
-            if (dataDescriptor.isBranch(data, mx_internal::_rootModel) &&
-                dataDescriptor.hasChildren(data, mx_internal::_rootModel))
-            {
-                nativeMenuItem.submenu = createMenu();
-                populateMenu(nativeMenuItem.submenu,
-                    dataDescriptor.getChildren(data, mx_internal::_rootModel));
-            }
-        }
-
-        // done!
-        menu.addItem(nativeMenuItem);
-    }
-
-    /**
-     *  Pops up this menu at the specified location.
-     *
-     *  @param stage The Stage object on which to display this menu.
-     *
+		var type:String = dataDescriptor.getType(data).toLowerCase();
+		var isSeparator:Boolean = (type == "separator");
+
+		// label changes later, but separator is read-only so need to know here
+		var nativeMenuItem:NativeMenuItem = new NativeMenuItem("", isSeparator);
+
+		if (!isSeparator)
+		{
+			// enabled
+			nativeMenuItem.enabled = dataDescriptor.isEnabled(data);
+
+			// checked
+			nativeMenuItem.checked = type == "check" && dataDescriptor.isToggled(data);
+
+			// data
+			nativeMenuItem.data = dataDescriptor.getData(data, mx_internal::_rootModel);
+
+			// key equivalent
+			nativeMenuItem.keyEquivalent = itemToKeyEquivalent(data);
+
+			// key equivalent modifiers
+			nativeMenuItem.keyEquivalentModifiers = itemToKeyEquivalentModifiers(data);
+
+			// label and mnemonic index
+			var labelData:String = itemToLabel(data);
+			var mnemonicIndex:int = itemToMnemonicIndex(data);
+
+			if (mnemonicIndex >= 0)
+			{
+				nativeMenuItem.label = parseLabelToString(labelData);
+				nativeMenuItem.mnemonicIndex = mnemonicIndex;
+			}
+			else
+			{
+				nativeMenuItem.label = parseLabelToString(labelData);
+				nativeMenuItem.mnemonicIndex = parseLabelToMnemonicIndex(labelData);
+			}
+
+			// event listeners
+			nativeMenuItem.addEventListener(flash.events.Event.SELECT, itemSelectHandler, false, 0, true);
+
+			// recursive
+			if (dataDescriptor.isBranch(data, mx_internal::_rootModel) &&
+				dataDescriptor.hasChildren(data, mx_internal::_rootModel))
+			{
+				nativeMenuItem.submenu = createMenu();
+				populateMenu(nativeMenuItem.submenu,
+					dataDescriptor.getChildren(data, mx_internal::_rootModel));
+			}
+		}
+
+		// done!
+		menu.addItem(nativeMenuItem);
+    }
+
+    /**
+     *  Pops up this menu at the specified location.
+     *
+     *  @param stage The Stage object on which to display this menu.
+     *
      *  @param x The number of horizontal pixels, relative to the origin of stage,
      *  at which to display this menu.
-     *
+     *
      *  @param y The number of vertical pixels, relative to the origin of stage,
      *  at which to display this menu.
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
      public function display(stage:Stage, x:int, y:int):void
      {
-        nativeMenu.display(stage, x, y);
+     	nativeMenu.display(stage, x, y);
      }

     /**
      *  Returns the key equivalent for the given data object
      *  based on the keyEquivalentField and keyEquivalentFunction
-     *  properties. If the method cannot convert the parameter to a String, it returns an
+	 *  properties. If the method cannot convert the parameter to a String, it returns an
      *  empty string.
      *
      *  @param data Object to be displayed.
      *
      *  @return The key equivalent based on the data.
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     protected function itemToKeyEquivalent(data:Object):String
     {
@@ -1581,10 +1454,6 @@
      *  @param data Object to be displayed.
      *
      *  @return The array of key equivalent modifiers based on the data
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     protected function itemToKeyEquivalentModifiers(data:Object):Array
     {
@@ -1599,18 +1468,14 @@

     /**
      *  Returns the String to use as the menu item label for the given data
-     *  object, based on the labelField and labelFunction
-     *  properties.
+	 *  object, based on the labelField and labelFunction
+	 *  properties.
      *  If the method cannot convert the parameter to a String, it returns a
      *  single space.
      *
      *  @param data Object to be displayed.
      *
      *  @return The string to be displayed based on the data.
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     protected function itemToLabel(data:Object):String
     {
@@ -1664,15 +1529,11 @@
     /**
      *  Returns the mnemonic index for the given data object
      *  based on the mnemonicIndexField and mnemonicIndexFunction
-     *  properties. If the method cannot convert the parameter to an integer, it returns -1.
+	 *  properties. If the method cannot convert the parameter to an integer, it returns -1.
      *
      *  @param data Object to be displayed.
      *
      *  @return The mnemonic index based on the data.
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
      */
     protected function itemToMnemonicIndex(data:Object):int
     {
@@ -1724,58 +1585,50 @@
     /**
      *  Determines the actual label to be used for the NativeMenuItem
      *  by removing underscore characters and converting escaped underscore
-     *  characters, if there are any.
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
+	 *  characters, if there are any.
      */
     protected function parseLabelToString(data:String):String
     {
-        const singleCharacter:RegExp = new RegExp(MNEMONIC_INDEX_CHARACTER, "g");
-        const doubleCharacter:RegExp = new RegExp(MNEMONIC_INDEX_CHARACTER + MNEMONIC_INDEX_CHARACTER, "g");
+    	const singleCharacter:RegExp = new RegExp(MNEMONIC_INDEX_CHARACTER, "g");
+    	const doubleCharacter:RegExp = new RegExp(MNEMONIC_INDEX_CHARACTER + MNEMONIC_INDEX_CHARACTER, "g");
+    	var dataWithoutEscapedUnderscores:Array = data.split(doubleCharacter);
+
+    	// now need to find lone underscores and remove it
+    	var len:int = dataWithoutEscapedUnderscores.length;
+    	for(var i:int = 0; i < len; i++)
+    	{
+    		var str:String = String(dataWithoutEscapedUnderscores[i]);
+    		dataWithoutEscapedUnderscores[i] = str.replace(singleCharacter, "");
+    	}
+
+    	return dataWithoutEscapedUnderscores.join(MNEMONIC_INDEX_CHARACTER);
+    }
+
+    /**
+     *  Extracts the mnemonic index from a label based on the presence of
+	 *  an underscore character. It finds the leading underscore character if
+     *  there is one and uses that as the index.
+     */
+    protected function parseLabelToMnemonicIndex(data:String):int
+    {
+    	const doubleCharacter:RegExp = new RegExp(MNEMONIC_INDEX_CHARACTER + MNEMONIC_INDEX_CHARACTER, "g");
         var dataWithoutEscapedUnderscores:Array = data.split(doubleCharacter);
-
-        // now need to find lone underscores and remove it
-        var len:int = dataWithoutEscapedUnderscores.length;
-        for(var i:int = 0; i < len; i++)
-        {
-            var str:String = String(dataWithoutEscapedUnderscores[i]);
-            dataWithoutEscapedUnderscores[i] = str.replace(singleCharacter, "");
-        }
-
-        return dataWithoutEscapedUnderscores.join(MNEMONIC_INDEX_CHARACTER);
-    }
-
-    /**
-     *  Extracts the mnemonic index from a label based on the presence of
-     *  an underscore character. It finds the leading underscore character if
-     *  there is one and uses that as the index.
-     *
-     *  @langversion 3.0
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    protected function parseLabelToMnemonicIndex(data:String):int
-    {
-        const doubleCharacter:RegExp = new RegExp(MNEMONIC_INDEX_CHARACTER + MNEMONIC_INDEX_CHARACTER, "g");
-        var dataWithoutEscapedUnderscores:Array = data.split(doubleCharacter);
-
-        // now need to find first underscore
-        var len:int = dataWithoutEscapedUnderscores.length;
-        var strLengthUpTo:int = 0; // length of string accumulator
-        for(var i:int = 0; i < len; i++)
-        {
-            var str:String = String(dataWithoutEscapedUnderscores[i]);
-            var index:int = str.indexOf(MNEMONIC_INDEX_CHARACTER);
-
-            if (index >= 0)
-                return index + strLengthUpTo;
-
-            strLengthUpTo += str.length + MNEMONIC_INDEX_CHARACTER.length;
-        }
-
-        return -1;
+
+    	// now need to find first underscore
+    	var len:int = dataWithoutEscapedUnderscores.length;
+    	var strLengthUpTo:int = 0; // length of string accumulator
+    	for(var i:int = 0; i < len; i++)
+    	{
+    		var str:String = String(dataWithoutEscapedUnderscores[i]);
+    		var index:int = str.indexOf(MNEMONIC_INDEX_CHARACTER);
+
+    		if (index >= 0)
+    			return index + strLengthUpTo;
+
+    		strLengthUpTo += str.length + MNEMONIC_INDEX_CHARACTER.length;
+    	}
+
+    	return -1;
     }

     //--------------------------------------------------------------------------
@@ -1783,8 +1636,8 @@
     //  Event handlers
     //
     //--------------------------------------------------------------------------
-
-    /**
+
+ 	/**
      *  @private
      */
     private function itemSelectHandler(event:Event):void
@@ -1794,11 +1647,11 @@
         var type:String = dataDescriptor.getType(nativeMenuItem.data).toLowerCase();
         if (type == "check")
         {
-            var checked:Boolean = !dataDescriptor.isToggled(nativeMenuItem.data);
-            nativeMenuItem.checked = checked;
-            dataDescriptor.setToggled(nativeMenuItem.data, checked);
-            // this causes an update event which ends up re-creating
-            // the whole menu... (SDK-13109)
+        	var checked:Boolean = !dataDescriptor.isToggled(nativeMenuItem.data);
+        	nativeMenuItem.checked = checked;
+        	dataDescriptor.setToggled(nativeMenuItem.data, checked);
+        	// this causes an update event which ends up re-creating
+        	// the whole menu... (SDK-13109)
         }

         var menuEvent:FlexNativeMenuEvent = new FlexNativeMenuEvent(FlexNativeMenuEvent.ITEM_CLICK);
@@ -1821,8 +1674,8 @@
         menuEvent.nativeMenu = nativeMenu;
         dispatchEvent(menuEvent);
     }
-
-    /**
+
+ 	/**
      *  @private
      */
     private function collectionChangeHandler(ce:CollectionEvent):void
@@ -1857,7 +1710,7 @@
         }
         else if (ce.kind == CollectionEventKind.UPDATE)
         {
-            dataProviderChanged = true;
+         	dataProviderChanged = true;
             invalidateProperties();
             // should handle elegantly with better performance
             // but can't right now


FLEX-33913 fix for lists getting mixed up

--- frameworks/projects/framework/src/mx/collections/XMLListAdapter.as
+++ frameworks/projects/framework/src/mx/collections/XMLListAdapter.as
@@ -246,14 +246,18 @@

 		setBusy();

-    	//e4x doesn't provide an insertion operator so you tend to do
-    	//addition.  if we're inserting at the first item we you add
-    	//the old 1st to the new one.  if inserting in the middle or end
-    	//you just add to the one before
-        if (index == 0)
-            source[0] = length > 0 ? item + source[0] : item;
-        else
-            source[index - 1] += item;
+		if (length > 0)
+		{
+			var localLength:uint = source.length();
+
+			// Adjust all indexes by 1
+			for (var i:uint = localLength; i>index; i--)
+			{
+				source[i] = source[i - 1];
+			}
+		}
+
+		source[index] = item;

         startTrackUpdates(item, seedUID + uidCounter.toString());
 		uidCounter++;


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

--- frameworks/projects/framework/src/mx/core/UIComponentDescriptor.as
+++ frameworks/projects/framework/src/mx/core/UIComponentDescriptor.as
@@ -44,6 +44,11 @@
  *  @see mx.core.Container#childDescriptors
  *  @see mx.core.Container#creationPolicy
  *  @see mx.core.Container#createComponentsFromDescriptors()
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
  */
 public class UIComponentDescriptor extends ComponentDescriptor
 {
@@ -63,6 +68,11 @@
 	 *  type, id, propertiesFactory,
 	 *  events, stylesFactory,
 	 *  and effects.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public function UIComponentDescriptor(descriptorProperties:Object)
     {
@@ -103,6 +113,11 @@
      *
This property is used by the Container method
 	 *  createComponentsFromDescriptors()
 	 *  to register the effects with the EffectManager.

+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public var effects:Array;

@@ -154,6 +169,11 @@
 	 *
      *
The stylesFactory property is null
 	 *  if no MXML styles were specified for the component instance.

+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public var stylesFactory:Function;


FLEX-23303: Made sure setting an index value of -1 fires the valueCommit event.

--- frameworks/projects/spark/src/spark/components/RadioButtonGroup.as
+++ frameworks/projects/spark/src/spark/components/RadioButtonGroup.as
@@ -320,6 +320,8 @@
         if (newValue == -1)
         {
             setSelection(null, false);
+            dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
+
             return;
         }


Transferred from the Adobe Open Source Subversion Repository

Revision: 15194
Author:   cframpto@adobe.com
Date:     2010-04-01T19:48:41.380474Z

Log Message:
-----------
Merge 15178, 15183 and 15186 from 4.x to trunk.  Includes TLF Build 601, paste change in RET and layoutDirection ASDoc changes in UIComponent.

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/bundles/en_US/docs/flashx.textLayout.operations.xml</path>
<path kind="dir" action="M">/flex/sdk/trunk</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/flex-config.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/src/flashx/textLayout/compose/StandardFlowComposer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/ReleaseNotes.txt</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/src/flashx/textLayout/edit/TextFlowEdit.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/rsls/textLayout_1.1.0.600.swf</path>
<path kind="file" copyfrom-path="/flex/sdk/branches/4.x/frameworks/rsls/textLayout_1.1.0.601.swf" copyfrom-rev="15183" action="A">/flex/sdk/trunk/frameworks/rsls/textLayout_1.1.0.601.swf</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/libs/textLayout.swc</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/textLayout/src/flashx/textLayout/BuildInfo.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RichEditableText.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/air-config.xml</path>

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

--- frameworks/projects/spark/src/spark/components/RichEditableText.as
+++ frameworks/projects/spark/src/spark/components/RichEditableText.as
@@ -3630,16 +3630,23 @@
          */
         private function handlePasteOperation(op:PasteOperation):void
         {
+            var hasConstraints:Boolean =
+                restrict || maxChars || displayAsPassword;
+
+            // If there are no constraints and multiline text is allowed
+            // there is nothing that needs to be done.
+            if (!hasConstraints && multiline)
+                return;
+
             // If copied/cut from displayAsPassword field the pastedText
             // is '*' characters but this is correct.
             var pastedText:String = TextUtil.extractText(op.textScrap.textFlow);
-            // See if there is anything we need to do.
-            if (!restrict && !maxChars && !displayAsPassword)
-            {
-                if (multiline || pastedText.indexOf("\n") == -1)
-                    return;
-            }
-
+
+            // If there are no constraints and no newlines there is nothing
+            // more to do.
+            if (!hasConstraints && pastedText.indexOf("\n") == -1)
+                return;
+
             // Save this in case we modify the pasted text.  We need to know
             // how much text to delete.
             var textLength:int = pastedText.length;


fix failing recursive attempt to update the draw calls from geometry when DrawCall.updateGeometry() calls Geometry.computeNormals()

--- src/aerys/minko/scene/controller/scene/RenderingController.as
+++ src/aerys/minko/scene/controller/scene/RenderingController.as
@@ -707,15 +707,19 @@
 													newGeometry	: Geometry) : void
 		{
 			var drawCalls	: Vector.<DrawCall>	= _meshToDrawCalls[mesh];
-			var numCalls	: uint				= drawCalls.length;
-			var frame		: uint				= mesh.frame;
-
-			for (var callId : uint = 0; callId < numCalls; ++callId)
-			{
-				var drawCall	: DrawCall	= drawCalls[callId];
-
-				drawCall.updateGeometry(newGeometry);
-				drawCall.setGeometry(newGeometry, frame);
+
+			if (drawCalls != null)
+			{
+				var numCalls	: uint				= drawCalls.length;
+				var frame		: uint				= mesh.frame;
+
+				for (var callId : uint = 0; callId < numCalls; ++callId)
+				{
+					var drawCall	: DrawCall	= drawCalls[callId];
+
+					drawCall.updateGeometry(newGeometry);
+					drawCall.setGeometry(newGeometry, frame);
+				}
 			}
 		}


Transferred from the Adobe Open Source Subversion Repository

Revision: 14124
Author:   cframpto@adobe.com
Date:     2010-02-11T17:53:35.882363Z

Log Message:
-----------
Merge 14123 from 4.x branch to trunk.

Log Message:
***********
Two additions/corrections to 14076.  Add key mappings for layoutDirection="rtl" for spark list components.  Correct type of keyCode variable so it is an uint rather than an int to match event.keyCode.

BitmapImage has a hard-coded layout direction="ltr".

QE notes: For layoutDirection="rtl" need to test LEFT, RIGHT, UP and DOWN keys.
Doc notes: None
Bugs: SDK-25330
Reviewed By: Hans
Tests run: checkintests
Is noteworthy for integration: No

Ticket Links:
***********
    http://bugs.adobe.com/jira/browse/SDK-25330

Modified Paths:
**************
    flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/containers/Accordion.as
    flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/controls/ButtonBar.as
    flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/controls/CalendarLayout.as
    flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/controls/ColorPicker.as
    flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/controls/Menu.as
    flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/controls/MenuBar.as
    flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/controls/RadioButton.as
    flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/controls/Tree.as
    flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/controls/colorPickerClasses/SwatchPanel.as
    flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/controls/listClasses/TileBase.as
    flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/controls/sliderClasses/SliderThumb.as
    flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/core/Container.as
    flex/sdk/branches/4.x/frameworks/projects/framework/src/mx/core/UIComponent.as
    flex/sdk/branches/4.x/frameworks/projects/spark/src/spark/components/List.as
    flex/sdk/branches/4.x/frameworks/projects/spark/src/spark/components/RadioButton.as
    flex/sdk/branches/4.x/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.as
    flex/sdk/branches/4.x/frameworks/projects/spark/src/spark/components/supportClasses/DropDownListBase.as
    flex/sdk/branches/4.x/frameworks/projects/spark/src/spark/components/supportClasses/SliderBase.as
    flex/sdk/branches/4.x/frameworks/projects/spark/src/spark/primitives/BitmapImage.as

Property Changed:
****************
    flex/sdk/branches/4.x/frameworks/

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/MenuBar.as</path>
<path kind="dir" action="M">/flex/sdk/trunk/frameworks</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/RadioButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RadioButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/Tree.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/ButtonBar.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/colorPickerClasses/SwatchPanel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/Menu.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/CalendarLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/Container.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/SliderBase.as</path>
<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/spark/src/spark/components/List.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/DropDownListBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/listClasses/TileBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/sliderClasses/SliderThumb.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/BitmapImage.as</path>

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

--- frameworks/projects/spark/src/spark/components/supportClasses/SliderBase.as
+++ frameworks/projects/spark/src/spark/components/supportClasses/SliderBase.as
@@ -725,9 +725,9 @@
         var prevValue:Number = this.value;
         var newValue:Number;

-        // If rtl layout, need to swap LEFT/UP for RIGHT/DOWN so correct action
+        // If rtl layout, need to swap LEFT/UP and RIGHT/DOWN so correct action
         // is done.
-        var keyCode:int = mapKeycodeForLayoutDirection(event, true);
+        var keyCode:uint = mapKeycodeForLayoutDirection(event, true);

         switch (keyCode)
         {


Transferred from the Adobe Open Source Subversion Repository

Revision: 8031
Author:   egeorgie@adobe.com
Date:     2009-06-20T01:10:03.288554Z

Log Message:
-----------
Scrub the TODOs in the framework, convert to FIXMEs in the new convention and assigning an owner.

Doc Notes: N/A
Bugs: N/A
Reviewer: Deepa
tests: build, checkintests

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/supportClasses/StrokedElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/ProgressBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/development/eclipse/flex/flex4test/src/layouts/WheelLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/Group.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/DateChooser.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/Container.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/components/supportClasses/Slider.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/components/Spinner.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/animation/Timeline.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AddAction.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/AnimateInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/Rotate.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/mediaClasses/VolumeBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/DropDownController.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/HSlider.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/collections/ModifiedCollectionView.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/spark/ErrorSkin.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/layouts/HorizontalLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/SkinnableDataContainer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimateTransform.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/SystemManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/StyleManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/List.as</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/flex4/src/spark/effects/supportClasses/MoveInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/effects/effectClasses/SequenceInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/effects/EffectTargetFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/SkinnableComponent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/AnimateTransformInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/RemoveAction.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/utils/BitmapUtil.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/DataGroup.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/spark/FocusSkin.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/supportClasses/GraphicElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/DropDownList.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/effects/CompositeEffect.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/animation/MotionPath.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/utils/MatrixUtil.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/layouts/supportClasses/LayoutElementHelper.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/supportClasses/TextGraphicElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flash-integration/src/mx/flash/UIMovieClip.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/PopUpAnchor.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/mediaClasses/StreamingVideoSource.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/effects/effectClasses/PropertyChanges.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/ToggleButtonBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/RemoveActionInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/effects/Effect.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/layouts/VerticalLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/pathSegments/LineSegment.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/VideoPlayer.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/supportClasses/AnimateTransitionShaderInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/RichEditableText.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/geom/Transform.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/utils/ObjectUtil.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/AddActionInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/ListBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/FocusManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/Path.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/Rect.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/SimpleText.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/StyleProtoChain.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/List.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/VSlider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/SkinnableContainer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/GroupBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/CursorManagerImpl.as</path>

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

--- frameworks/projects/spark/src/spark/components/supportClasses/SliderBase.as
+++ frameworks/projects/spark/src/spark/components/supportClasses/SliderBase.as
@@ -476,7 +476,7 @@
         if (event.isDefaultPrevented())
             return;

-        // TODO: Provide a way to easily override the keyboard
+        // FIXME (hmuller): Provide a way to easily override the keyboard
         // behavior. This means having a callback in the subclasses
         // that tell the superclass all the positions in an array
         // but defaulting to the normal stepping behavior when no
@@ -573,7 +573,7 @@
                     var animTarget:AnimationTarget = new AnimationTarget(animationUpdateHandler);
                     animTarget.endFunction = animationEndHandler;
                     animator.animationTarget = animTarget;
-                    // TODO (chaase): hard-coding easer for now - how to style it?
+                    // FIXME (chaase): hard-coding easer for now - how to style it?
                     animator.easer = new Sine(0);
                 }
                 animator.stop();


Added hack to allow empty column title in probe text

Change-Id: I5773d2706a9c273bfb851ce82b437c856007a8b6

--- WeaveUI/src/weave/utils/ProbeTextUtils.as
+++ WeaveUI/src/weave/utils/ProbeTextUtils.as
@@ -26,6 +26,7 @@
 	import mx.core.IToolTip;
 	import mx.managers.ToolTipManager;
 	import mx.utils.ObjectUtil;
+	import mx.utils.StringUtil;

 	import weave.Weave;
 	import weave.api.core.ILinkableHashMap;
@@ -103,7 +104,10 @@
 					if (value == '' || value == 'NaN')
 						continue;
 					var title:String = ColumnUtils.getTitle(column);
-					var line:String = StandardLib.lpad(value, 8) + ' (' + title + ')\n';
+					var line:String = StandardLib.lpad(value, 8);
+					if (StringUtil.trim(title)) // hack to allow column with no title
+						line += ' (' + title + ')';
+					line += '\n';
 					// prevent duplicate lines from being added
 					if (lookup[line] == undefined)
 					{
@@ -177,7 +181,7 @@
 			probeToolTip.visible = true;

 			// make tooltip completely opaque because text + graphics on same sprite is slow
-			setProbeToolTipAppearance() ;
+			setProbeToolTipAppearance();

 			//this step is required to set the height and width of probeToolTip to the right size.
 			(probeToolTip as ToolTip).validateNow();
@@ -186,7 +190,6 @@
 			var yMin:Number = bounds.getYNumericMin();
 			var xMax:Number = bounds.getXNumericMax() - probeToolTip.width;
 			var yMax:Number = bounds.getYNumericMax() - probeToolTip.height;
-			var b:Boolean = false;
 			var yAxisToolTip:IToolTip = SimpleInteractiveVisualization.yAxisTooltipPtr ;
 			var xAxisToolTip:IToolTip = SimpleInteractiveVisualization.xAxisTooltipPtr ;

@@ -196,13 +199,13 @@
 			if (toolTipAbove)
 			{
 				y = stageY - (probeToolTip.height + 2 * margin);
-				if(yAxisToolTip != null)
+				if (yAxisToolTip != null)
 					y = yAxisToolTip.y - margin - probeToolTip.height ;
 			}
 			else // below
 			{
 				y = stageY + margin * 2;
-				if(yAxisToolTip != null)
+				if (yAxisToolTip != null)
 					y = yAxisToolTip.y + yAxisToolTip.height+margin;
 			}


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

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

 package mx.events
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 8
Author:   open-source-svn-admin@adobe.com
Date:     2007-12-15T01:49:31.087529Z

Log Message:
-----------
The beginning of the open-source Flex SDK.

Populated the flex/sdk/trunk directory with an open-source subset of files from //depot/flex/sdk/...@191097 in the Faramir Perforce server. This changelist is a bit past the 3.0rc0 build.

The Ant scripts will not successfully build yet. They need to be adapted to the open-source subset.

Modified Paths:
--------------
2532 paths were modified

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

--- frameworks/projects/rpc/src/mx/messaging/AbstractConsumer.as
+++ frameworks/projects/rpc/src/mx/messaging/AbstractConsumer.as
@@ -0,0 +1,849 @@
+/*************************************************************************
+ *
+ * ADOBE CONFIDENTIAL
+ * __________________
+ *
+ *  [2002] - [2007] Adobe Systems Incorporated
+ *  All Rights Reserved.
+ *
+ * NOTICE:  All information contained herein is, and remains
+ * the property of Adobe Systems Incorporated and its suppliers,
+ * if any.  The intellectual and technical concepts contained
+ * herein are proprietary to Adobe Systems Incorporated
+ * and its suppliers and may be covered by U.S. and Foreign Patents,
+ * patents in process, and are protected by trade secret or copyright law.
+ * Dissemination of this information or reproduction of this material
+ * is strictly forbidden unless prior written permission is obtained
+ * from Adobe Systems Incorporated.
+ */
+package mx.messaging
+{
+
+import flash.events.TimerEvent;
+import flash.utils.Timer;
+
+import mx.core.mx_internal;
+import mx.events.PropertyChangeEvent;
+import mx.logging.Log;
+import mx.messaging.channels.PollingChannel;
+import mx.messaging.events.ChannelEvent;
+import mx.messaging.events.ChannelFaultEvent;
+import mx.messaging.events.MessageEvent;
+import mx.messaging.events.MessageFaultEvent;
+import mx.messaging.messages.AcknowledgeMessage;
+import mx.messaging.messages.CommandMessage;
+import mx.messaging.messages.ErrorMessage;
+import mx.messaging.messages.IMessage;
+import mx.resources.IResourceManager;
+import mx.resources.ResourceManager;
+
+use namespace mx_internal;
+
+/**
+ *  Dispatched when a message is received by the Consumer.
+ *
+ *  @eventType mx.messaging.events.MessageEvent.MESSAGE
+ */
+[Event(name="message", type="mx.messaging.events.MessageEvent")]
+
+[ResourceBundle("messaging")]
+
+/**
+ *  The AbstractConsumer is the base class for both the Consumer and
+ *  MultiTopicConsumer classes.  You use those classes to receive pushed
+ *  messages from the server.
+ */
+public class AbstractConsumer extends MessageAgent
+{
+    //--------------------------------------------------------------------------
+    //
+    // Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructs a Consumer.
+     *
+     *
+     *  @example
+     *  <listing version="3.0">
+     *   function initConsumer():void
+     *   {
+     *       var consumer:Consumer = new Consumer();
+     *       consumer.destination = "NASDAQ";
+     *       consumer.selector = "operation IN ('Bid','Ask')";
+     *       consumer.addEventListener(MessageEvent.MESSAGE, messageHandler);
+     *       consumer.subscribe();
+     *   }
+     *
+     *   function messageHandler(event:MessageEvent):void
+     *   {
+     *       var msg:IMessage = event.message;
+     *       var info:Object = msg.body;
+     *       trace("-App recieved message: " + msg.toString());
+     *   }
+     *   </listing>
+     */
+	public function AbstractConsumer()
+	{
+		super();
+	    _log = Log.getLogger("mx.messaging.Consumer");
+		_agentType = "consumer";
+	}
+
+    //--------------------------------------------------------------------------
+    //
+    // Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  This is the current number of resubscribe attempts that we've done.
+     */
+    private var _currentAttempt:int;
+
+    /**
+     *  @private
+     *  The timer used for resubscribe attempts.
+     */
+    private var _resubscribeTimer:Timer;
+
+	/**
+	 *  Flag indicating whether this consumer should be subscribed or not.
+	 */
+	protected var _shouldBeSubscribed:Boolean;
+
+    /**
+     *  @private
+     *  Current subscribe message - used for resubscribe attempts.
+     */
+    private var _subscribeMsg:CommandMessage;
+
+    /**
+     *  @private
+     */
+    private var resourceManager:IResourceManager =
+									ResourceManager.getInstance();
+
+    //--------------------------------------------------------------------------
+    //
+    // Properties
+    //
+    //--------------------------------------------------------------------------
+
+	//----------------------------------
+	//  clientId
+	//----------------------------------
+
+    /**
+     *  @private
+     *  If our clientId has changed we may need to unsubscribe() using the
+     *  current clientId and then resubscribe using the new clientId.
+     *  // TODO - remove this?
+     *
+     *  @param value The clientId value.
+     */
+	override mx_internal function setClientId(value:String):void
+	{
+		if (super.clientId != value)
+		{
+		    var resetSubscription:Boolean = false;
+			if (subscribed)
+			{
+				unsubscribe();
+				resetSubscription = true;
+		    }
+
+			super.setClientId(value);
+
+			if (resetSubscription)
+				subscribe(value);
+		}
+	}
+
+	//----------------------------------
+	//  destination
+	//----------------------------------
+
+    /**
+     *  @private
+     *  Updates the destination for this Consumer and resubscribes if the
+     *  Consumer is currently subscribed.
+     */
+	override public function set destination(value:String):void
+	{
+	    if (destination != value)
+	    {
+	        var resetSubscription:Boolean = false;
+            if (subscribed)
+            {
+                unsubscribe();
+                resetSubscription = true;
+            }
+
+            super.destination = value;
+
+            if (resetSubscription)
+                subscribe();
+        }
+	}
+
+	//----------------------------------
+	//  resubscribeAttempts
+	//----------------------------------
+
+    /**
+     *  @private
+     */
+    private var _resubscribeAttempts:int = 5;
+
+    [Bindable(event="propertyChange")]
+
+	/**
+	 *  The number of resubscribe attempts that the Consumer makes in the event
+	 *  that the destination is unavailable or the connection to the destination fails.
+	 *  A value of -1 enables infinite attempts.
+	 *  A value of zero disables resubscribe attempts.
+	 *

+	 *  Resubscribe attempts are made at a constant rate according to the resubscribe interval
+	 *  value. When a resubscribe attempt is made if the underlying channel for the Consumer is not
+	 *  connected or attempting to connect the channel will start a connect attempt.
+	 *  Subsequent Consumer resubscribe attempts that occur while the underlying
+	 *  channel connect attempt is outstanding are effectively ignored until
+	 *  the outstanding channel connect attempt succeeds or fails.
+	 *

+	 *
+	 *  @see mx.messaging.Consumer#resubscribeInterval
+	 */
+	public function get resubscribeAttempts():int
+	{
+	    return _resubscribeAttempts;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set resubscribeAttempts(value:int):void
+	{
+	    if (_resubscribeAttempts != value)
+	    {
+	        if (value == 0)
+	            stopResubscribeTimer();
+
+	        var event:PropertyChangeEvent = PropertyChangeEvent.createUpdateEvent(this, "resubscribeAttempts", _resubscribeAttempts, value);
+	        _resubscribeAttempts = value;
+	        dispatchEvent(event);
+	    }
+	}
+
+	//----------------------------------
+	//  resubscribeInterval
+	//----------------------------------
+
+    /**
+     *  @private
+     */
+    private var _resubscribeInterval:int = 5000;
+
+    [Bindable(event="propertyChange")]
+
+	/**
+	 *  The number of milliseconds between resubscribe attempts.
+	 *  If a Consumer doesn't receive an acknowledgement for a subscription
+	 *  request, it will wait the specified number of milliseconds before
+	 *  attempting to resubscribe.
+	 *  Setting the value to zero disables resubscriptions.
+	 *

+	 *  Resubscribe attempts are made at a constant rate according to this
+	 *  value. When a resubscribe attempt is made if the underlying channel for the Consumer is not
+	 *  connected or attempting to connect the channel will start a connect attempt.
+	 *  Subsequent Consumer resubscribe attempts that occur while the underlying
+	 *  channel connect attempt is outstanding are effectively ignored until
+	 *  the outstanding channel connect attempt succeeds or fails.
+	 *

+	 *
+	 *  @see mx.messaging.Consumer#resubscribeInterval
+	 *
+	 *  @throws ArgumentError If the assigned value is negative.
+	 */
+	public function get resubscribeInterval():int
+	{
+	    return _resubscribeInterval;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set resubscribeInterval(value:int):void
+	{
+	    if (_resubscribeInterval != value)
+	    {
+	        if (value < 0)
+			{
+				var message:String = resourceManager.getString(
+					"messaging", "resubscribeIntervalNegative");
+	            throw new ArgumentError(message);
+			}
+		    else if (value == 0)
+			{
+		        stopResubscribeTimer();
+			}
+		    else if (_resubscribeTimer != null)
+			{
+		        _resubscribeTimer.delay = value;
+			}
+
+		    var event:PropertyChangeEvent = PropertyChangeEvent.createUpdateEvent(this, "resubscribeInterval", _resubscribeInterval, value);
+		    _resubscribeInterval = value;
+		    dispatchEvent(event);
+		}
+	}
+
+	//----------------------------------
+	//  subscribed
+	//----------------------------------
+
+	/**
+	 *  @private
+	 */
+	private var _subscribed:Boolean;
+
+	[Bindable(event="propertyChange")]
+
+	/**
+	 *  Indicates whether the Consumer is currently subscribed. The propertyChange
+	 *  event is dispatched when this property changes.
+	 */
+	public function get subscribed():Boolean
+	{
+		return _subscribed;
+	}
+
+	/**
+	 *  @private
+	 */
+	protected function setSubscribed(value:Boolean):void
+	{
+	    if (_subscribed != value)
+	    {
+	        var event:PropertyChangeEvent = PropertyChangeEvent.createUpdateEvent(this, "subscribed", _subscribed, value);
+	        _subscribed = value;
+
+	        // Register or unregister our subscription state with the ConsumerMessageDispatcher.
+	        // This allows the singleton ConsumerMessageDispatcher to start or stop listening for
+	        // messages on our behalf.
+	        if (_subscribed)
+            {
+	            ConsumerMessageDispatcher.getInstance().registerSubscription(this);
+                if (channelSet != null && channelSet.currentChannel != null && channelSet.currentChannel is PollingChannel)
+                    PollingChannel(channelSet.currentChannel).enablePolling();
+            }
+	        else
+            {
+    	        ConsumerMessageDispatcher.getInstance().unregisterSubscription(this);
+                if (channelSet != null && channelSet.currentChannel != null && channelSet.currentChannel is PollingChannel)
+                    PollingChannel(channelSet.currentChannel).disablePolling();
+            }
+
+	        dispatchEvent(event);
+	    }
+	}
+
+	//----------------------------------
+	//  timestamp
+	//----------------------------------
+
+	/**
+	 *  @private
+	 */
+	private var _timestamp:Number = -1;
+
+    [Bindable(event="propertyChange")]
+
+	/**
+	 *  Contains the timestamp of the most recent message this Consumer
+	 *  has received.
+	 *  This value is passed to the destination in a receive() call
+	 *  to request that it deliver messages for the Consumer from the timestamp
+	 *  forward.
+	 *  All messages with a timestamp value greater than the
+	 *  timestamp value will be returned during a poll operation.
+	 *  Setting this value to -1 will retrieve all cached messages from the
+	 *  destination.
+	 */
+	public function get timestamp():Number
+	{
+	    return _timestamp;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set timestamp(value:Number):void
+	{
+	    if (_timestamp != value)
+	    {
+	        var event:PropertyChangeEvent = PropertyChangeEvent.createUpdateEvent(this, "timestamp", _timestamp, value);
+	        _timestamp = value;
+	        dispatchEvent(event);
+	    }
+	}
+
+    //--------------------------------------------------------------------------
+    //
+    // Overridden Methods
+    //
+    //--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+     *  Custom processing for subscribe, unsubscribe and poll message
+     *  acknowledgments.
+     *
+     *  @param ackMsg The AcknowledgeMessage.
+     *
+     *  @param msg The original subscribe, unsubscribe or poll message.
+	 */
+	override public function acknowledge(ackMsg:AcknowledgeMessage, msg:IMessage):void
+	{
+	    // Ignore acks for any outstanding messages that return after disconnect() is invoked.
+	    if (_disconnectBarrier)
+	        return;
+
+	    // Only run Consumer processing if this isn't an error.
+	    if (!ackMsg.headers[AcknowledgeMessage.ERROR_HINT_HEADER] && (msg is CommandMessage))
+	    {
+	        var command:CommandMessage = msg as CommandMessage;
+
+            var op:int = command.operation;
+
+            // For MultiTopicConsumers, the message gets marked if this is the
+            // message completely unsubscribes the client.
+            if (op == CommandMessage.MULTI_SUBSCRIBE_OPERATION)
+            {
+                if (msg.headers.DSlastUnsub != null)
+                   op = CommandMessage.UNSUBSCRIBE_OPERATION;
+                else
+                   op = CommandMessage.SUBSCRIBE_OPERATION;
+            }
+
+	        switch (op)
+	        {
+	            case CommandMessage.UNSUBSCRIBE_OPERATION:
+                    if (Log.isInfo())
+                        _log.info("'{0}' {1} acknowledge for unsubscribe.", id, _agentType);
+                    super.setClientId(null);
+                    setSubscribed(false); // Stop listening for messages.
+                    ackMsg.clientId = null; // Force the ack's clientId to null as well before ack'ing it.
+                    super.acknowledge(ackMsg, msg);
+                break;
+
+                case CommandMessage.SUBSCRIBE_OPERATION:
+                    stopResubscribeTimer();
+                    // NOTE: the -1 in the timestamp assignment below.
+                    // This works around a bug where if a Producer sends
+                    // a message in the same batch as the subscribe,
+                    // it will end up with (likely) the same timestamp
+                    // as the consumer.  Because the message is sent
+                    // by the client after the subscribe though, it
+                    // should still be delivered.
+                    // TODO: Improve solution here.
+                    if (ackMsg.timestamp > _timestamp)
+                        _timestamp = ackMsg.timestamp - 1;
+
+                    if (Log.isInfo())
+                        _log.info("'{0}' {1} acknowledge for subscribe. Client id '{2}' new timestamp {3}",
+                                    id, _agentType, ackMsg.clientId, _timestamp);
+                    super.setClientId(ackMsg.clientId);
+                    setSubscribed(true);
+                    super.acknowledge(ackMsg, msg);
+                break;
+
+                // Handle the result of a receive() invocation (a Consumer instance-specific poll request).
+                case CommandMessage.POLL_OPERATION:
+                	if ((ackMsg.body != null) && (ackMsg.body is Array))
+                	{
+			            var messageList:Array = ackMsg.body as Array;
+                        for each (var message:IMessage in messageList)
+                            messageHandler(MessageEvent.createEvent(MessageEvent.MESSAGE, message));
+		            }
+		            super.acknowledge(ackMsg, msg);
+                break;
+            }
+	    }
+	    else
+	    {
+	        super.acknowledge(ackMsg, msg);
+	    }
+	}
+
+	/**
+	 *  Disconnects the Consumer from its remote destination.
+	 *  This method should be invoked on a Consumer that is no longer
+	 *  needed by an application after unsubscribing.
+	 *  This method does not wait for outstanding network operations to complete
+	 *  and does not send an unsubscribe message to the server.
+	 *  After invoking disconnect(), the Consumer will report that it is in an
+	 *  disconnected, unsubscribed state because it will not receive any more
+	 *  messages until it has reconnected and resubscribed.
+	 *  Disconnecting stops automatic resubscription attempts if they are running.
+	 */
+	override public function disconnect():void
+	{
+	    // We don't invoke unsubscribe() in this case because a Consumer subscribed to a
+	    // JMS destination durably will blow away the durable subscription.
+	    _shouldBeSubscribed = false; // Prevent resubscribe attempts.
+        stopResubscribeTimer();
+        setSubscribed(false);
+
+        super.disconnect();
+	}
+
+	/**
+	 *  @private
+     *  The Consumer supresses ErrorMessage processing if the error is
+     *  retryable and it is configured to resubscribe.
+     *
+     *  @param errMsg The ErrorMessage describing the fault.
+     *
+     *  @param msg The original message (generally a subscribe).
+	 */
+	override public function fault(errMsg:ErrorMessage, msg:IMessage):void
+    {
+        // Ignore faults for any outstanding messages that return after disconnect() is invoked.
+	    if (_disconnectBarrier)
+	        return;
+
+        if (errMsg.headers[ErrorMessage.RETRYABLE_HINT_HEADER])
+        {
+            if (_resubscribeTimer == null)
+            {
+    	        // If this error correlates to our current subscribe message,
+    	        // we should no longer be subscribed.
+    	        if ((_subscribeMsg != null) && (errMsg.correlationId == _subscribeMsg.messageId))
+    	            _shouldBeSubscribed = false;
+    	        super.fault(errMsg, msg);
+    	    }
+    	    // Else, suppress the fault dispatch because the resubscribe
+    	    // timer is running and will generate a fault when it runs out of
+    	    // allowed resubscribe attempts.
+	    }
+	    else
+	    {
+	        super.fault(errMsg, msg);
+	    }
+    }
+
+    /**
+     *  @private
+     *  Custom processing to start up a resubscribe timer if our channel is
+     *  disconnected when we should be subscribed.
+     *
+     *  @param event The ChannelEvent.
+     */
+    override public function channelDisconnectHandler(event:ChannelEvent):void
+	{
+	    setSubscribed(false);
+
+	    super.channelDisconnectHandler(event);
+
+	    if (_shouldBeSubscribed && !event.rejected)
+            startResubscribeTimer();
+	}
+
+	/**
+	 *  @private
+	 *  Custom processing to start up a resubscribe timer if our channel faults
+	 *  when we should be subscribed.
+	 *
+	 *  @param event The ChannelFaultEvent.
+	 */
+	override public function channelFaultHandler(event:ChannelFaultEvent):void
+	{
+	    if (!event.channel.connected)
+	        setSubscribed(false);
+
+	    super.channelFaultHandler(event);
+
+	    if (_shouldBeSubscribed && !event.rejected && !event.channel.connected)
+	        startResubscribeTimer();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Methods
+    //
+    //--------------------------------------------------------------------------
+
+	/**
+	 *  Requests any messages that are queued for this Consumer on the server.
+	 *  This method should only be used for Consumers that subscribe over non-realtime,
+	 *  non-polling channels.
+	 *  This method is a no-op if the Consumer is not subscribed.
+	 *
+	 *  @param timestamp This argument is deprecated and is ignored.
+	 */
+	public function receive(timestamp:Number = 0):void
+	{
+	    if (clientId != null) // We need a clientId to distinguish this from a generic poll request sent by a polling channel.
+	    {
+    		var msg:CommandMessage = new CommandMessage();
+            msg.operation = CommandMessage.POLL_OPERATION;
+            msg.destination = destination;
+    		internalSend(msg);
+        }
+	}
+
+	/**
+     *  Subscribes to the remote destination.
+	 *
+	 *  @param clientId The client id to subscribe with. Use null for non-durable Consumers. If the subscription is durable, a consistent
+	 *                  value must be supplied every time the Consumer subscribes in order
+	 *                  to reconnect to the correct durable subscription in the remote destination.
+	 *
+	 *  @throws mx.messaging.errors.InvalidDestinationError If no destination is set.
+	 */
+	public function subscribe(clientId:String = null):void
+	{
+        // Set a flag to determine whether the passed clientId differs from the
+        // current value and should be assigned.
+        var resetClientId:Boolean = ((clientId != null) &&
+                                (super.clientId != clientId)) ? true : false;
+
+        if (subscribed && resetClientId)
+        {
+            // We're already subscribed, but we need to resubscribe under
+            // the new clientId.
+            unsubscribe();
+        }
+
+        // Make sure any resubscribe timer is stopped.
+        stopResubscribeTimer();
+
+        _shouldBeSubscribed = true;
+        if (resetClientId)
+            super.setClientId(clientId);
+        if (Log.isInfo())
+            _log.info("'{0}' {1} subscribe.", id, _agentType);
+        _subscribeMsg = buildSubscribeMessage();
+
+        internalSend(_subscribeMsg);
+	}
+
+	/**
+     *  Unsubscribes from the remote destination. In the case of durable JMS
+     *  subscriptions, this will destroy the durable subscription on the JMS server.
+     *
+     *  @param preserveDurable - when true, durable JMS subscriptions are not destroyed
+	 * 		allowing consumers to later resubscribe and receive missed messages
+	 */
+	public function unsubscribe(preserveDurable:Boolean = false):void
+	{
+        _shouldBeSubscribed = false;
+        if (subscribed)
+        {
+        	// Stop listening now for any messages as we could be set to a new
+        	// channel before the ack comes back, and once the ack returns we
+        	// will no longer have a valid client id.
+            if (channelSet != null)
+		        channelSet.removeEventListener(destination, messageHandler);
+
+		    if (Log.isInfo())
+                _log.info("'{0}' {1} unsubscribe.", id, _agentType);
+
+            internalSend(buildUnsubscribeMessage(preserveDurable));
+	    }
+	    else
+	    {
+	        stopResubscribeTimer();
+        }
+	}
+
+    //--------------------------------------------------------------------------
+    //
+    // Internal Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+	 *  @private
+	 *  Consumers subscribe for messages from a destination and this is the handler
+	 *  method that is invoked when a message for this Consumer is pushed or polled
+	 *  from the server.
+	 *
+	 *  @param event The MessageEvent.
+	 */
+	mx_internal function messageHandler(event:MessageEvent):void
+	{
+	    // NOTE: This method is invoked directly by the ConsumerMessageDispatcher.
+	    // The event flow for a pushed message is:
+	    // 1. Channel receives a pushed/polled message and dispatches a message event
+	    // 2. Any ChannelSets connected to the Channel will handle these events in ChannelSet.messageHandler();
+	    //    simply redispatching them.
+	    // 3. Consumers that subscribe to a destination trigger the internal use of a shared ConsumerMessageDispatcher
+	    //    that listens for message events from any ChannelSets that Consumers have subscribed over and this helper routes pushed messages to the proper Consumer instances.
+	    var message:IMessage = event.message;
+	    if (message is CommandMessage)
+        {
+            var command:CommandMessage = message as CommandMessage;
+            switch (command.operation)
+            {
+                case CommandMessage.SUBSCRIPTION_INVALIDATE_OPERATION:
+                    // We've been unsubscribed but it wasn't the result of an unsubscribe
+                    // message this agent sent. If a polling channel is being used, let it know.
+                    if (channelSet.currentChannel is PollingChannel)
+                        PollingChannel(channelSet.currentChannel).disablePolling();
+                    disconnect();
+                break;
+                default:
+                    if (Log.isWarn())
+                        _log.warn("'{0}' received a CommandMessage '{1}' that could not be handled.", id, CommandMessage.getOperationAsString(command.operation));
+            }
+            /*
+             * Command messages are handled internally by the Consumer and
+             * are not dispatched to message listeners via MessageEvents.
+             */
+            return;
+        }
+
+        if (message.timestamp > _timestamp)
+            _timestamp = message.timestamp;
+
+		// Server might push out error messages (eg. during MessageClient.invalidate)
+		// that need to be dispatched as message fault events.
+		if (message is ErrorMessage)
+			dispatchEvent(MessageFaultEvent.createEvent(ErrorMessage(message)));
+		else
+			dispatchEvent(MessageEvent.createEvent(MessageEvent.MESSAGE, message));
+	}
+
+    //--------------------------------------------------------------------------
+    //
+    // Protected Methods
+    //
+    //--------------------------------------------------------------------------
+
+	/**
+	 *  Returns a subscribe message.
+	 *  This method should be overridden by subclasses if they need custom
+	 *  subscribe messages.
+	 *
+	 *  @return The subscribe CommandMessage.
+	 */
+	protected function buildSubscribeMessage():CommandMessage
+	{
+        var msg:CommandMessage = new CommandMessage();
+        msg.operation = CommandMessage.SUBSCRIBE_OPERATION;
+        msg.clientId = clientId;
+        msg.destination = destination;
+        return msg;
+	}
+
+	/**
+	 *  Returns an unsubscribe message.
+	 *  This method should be overridden by subclasses if they need custom
+	 *  unsubscribe messages.
+	 *
+	 *  @param preserveDurable - when true, durable JMS subscriptions are not destroyed
+	 * 			allowing consumers to later resubscribe and receive missed messages
+	 *
+	 *  @return The unsubscribe CommandMessage.
+	 */
+	protected function buildUnsubscribeMessage(preserveDurable:Boolean):CommandMessage
+	{
+        var msg:CommandMessage = new CommandMessage();
+        msg.operation = CommandMessage.UNSUBSCRIBE_OPERATION;
+        msg.clientId = clientId;
+        msg.destination = destination;
+
+        // only include the PRESERVE_DURABLE_HEADER param in the message if
+        // its value is true
+        if (preserveDurable)
+        	msg.headers[CommandMessage.PRESERVE_DURABLE_HEADER] = preserveDurable;
+
+        return msg;
+	}
+
+    /**
+     *  @private
+     *  Attempt to resubscribe.
+     *  This can be called directly or from a Timer's event handler.
+     *
+     *  @param event The timer event for resubscribe attempts.
+     */
+    protected function resubscribe(event:TimerEvent):void
+    {
+        // If we're past our limit of attempts, fault out.
+        if ((_resubscribeAttempts != -1) &&
+            (_currentAttempt >= _resubscribeAttempts))
+        {
+            stopResubscribeTimer();
+            _shouldBeSubscribed = false;
+            var errMsg:ErrorMessage = new ErrorMessage();
+			errMsg.faultCode = "Client.Error.Subscribe";
+            errMsg.faultString = resourceManager.getString(
+				"messaging", "consumerSubscribeError");
+            errMsg.faultDetail = resourceManager.getString(
+				"messaging", "failedToSubscribe");
+            errMsg.correlationId = _subscribeMsg.messageId;
+            fault(errMsg, _subscribeMsg);
+            return;
+        }
+
+        if (Log.isDebug())
+            _log.debug("'{0}' {1} trying to resubscribe.", id, _agentType);
+
+        _resubscribeTimer.delay = _resubscribeInterval;
+        _currentAttempt++;
+        // Send the resubscribe message, skipping the MessageAgent's queue that blocks
+        // messages until the clientId is set.
+        internalSend(_subscribeMsg, false);
+    }
+
+	/**
+	 *  @private
+     *  This method will start a timer which attempts to resubscribe
+     *  periodically.
+     */
+    protected function startResubscribeTimer():void
+    {
+        if (_shouldBeSubscribed && (_resubscribeTimer == null))
+        {
+            // If we're configured for resubscribe start up the timer.
+            if ((_resubscribeAttempts != 0) && (_resubscribeInterval > 0))
+            {
+                if (Log.isDebug())
+                    _log.debug("'{0}' {1} starting resubscribe timer.", id, _agentType);
+	            /*
+	             * Initially, the timeout is set to 1 so we try to
+	             * reconnect immediately (perhaps to a different channel).
+	             * after that, it will poll at the configured time interval.
+	             */
+	            _resubscribeTimer = new Timer(1);
+	            _resubscribeTimer.addEventListener(TimerEvent.TIMER, resubscribe);
+	            _resubscribeTimer.start();
+	            _currentAttempt = 0;
+            }
+        }
+    }
+
+    /**
+     * @private
+     * Stops a resubscribe timer if one is running.
+     */
+    protected function stopResubscribeTimer():void
+    {
+        if (_resubscribeTimer != null)
+        {
+            if (Log.isDebug())
+                _log.debug("'{0}' {1} stopping resubscribe timer.", id, _agentType);
+
+            _resubscribeTimer.removeEventListener(TimerEvent.TIMER, resubscribe);
+            _resubscribeTimer.reset();
+            _resubscribeTimer = null;
+        }
+	}
+}
+
+}


Remove trailing whitespace.

Remove trailing whitespace.


Correct hardcoded value.

Correct hardcoded value.

--- HLSPlugin/src/org/osmf/net/httpstreaming/HLSHTTPNetStream.as
+++ HLSPlugin/src/org/osmf/net/httpstreaming/HLSHTTPNetStream.as
@@ -158,7 +158,7 @@
 				addEventListener(DRMStatusEvent.DRM_STATUS, onDRMStatus);
 			}

-			this.bufferTime = 0.1;
+			this.bufferTime = HLSManifestParser.INITIAL_BUFFER_THRESHOLD;
 			this.bufferTimeMax = 0;

 			setState(HTTPStreamingState.INIT);
@@ -2384,4 +2384,4 @@

 		private static const HIGH_PRIORITY:int = int.MAX_VALUE;
 	}
-}+}


Whitespace

Whitespace