Fix for performance problems related to handling of dynamic types

--- as3/xobjas3/src/com/rpath/xobj/XObjUtils.as
+++ as3/xobjas3/src/com/rpath/xobj/XObjUtils.as
@@ -207,6 +207,8 @@
         return result;
     }

+    public static var callCounter:int;
+
     public static function typeInfoForProperty(object:*, className:String, propName:String):XObjTypeInfo
     {
         var isArray:Boolean = false;
@@ -223,13 +225,18 @@
             return new XObjTypeInfo();
         }

+        if (!propName)
+            return new XObjTypeInfo();
+
         var propertyCacheKey:String = className + "." + propName;
         var arrayElementType:String;

         typeInfo = typePropertyCache[propertyCacheKey];

-        if (typeInfo == null || (propName in object))
-        {
+        if (typeInfo == null)
+        {
+            callCounter++;
+            trace("callCounter "+callCounter);
             typeInfo = new XObjTypeInfo();

             // go look it up (expensive)
@@ -242,7 +249,6 @@
             if (typeDescInfo.@isDynamic == 'true')
             {
                 isDynamic = true;
-                shouldCache = false;
             }

             var accessorList:XMLList = typeDescInfo..accessor.(@name == propName);
@@ -266,12 +272,18 @@
                         }
                         else
                         {
-                            // must be dynamic property
+                            // must be dynamic property or simply an error (no such property)
                             typeInfo.typeName = XObjUtils.getClassName(val);
+                            // don't cache if dynamic
+                            if (isDynamic)
+                                shouldCache = false;
                         }
                     }
+                    else
+                    {
+                        // bad request. no such property
+                    }
                 }
-
                 else
                 {
                     arrayElementType = typeDescInfo..variable.(@name == propName).metadata.(@name == 'ArrayElementType').arg.@value.toString().replace( /::/, "." );


Bug 469377: add testcase for Vector.<String> unshift()

--- test/acceptance/as3/Vector/unshift.as
+++ test/acceptance/as3/Vector/unshift.as
@@ -91,4 +91,14 @@
 		"unshift single element vector with single item",
 		"RangeError: Error #1126",
 		parseError(errormsg,"RangeError: Error #1126".length));
+
+// bug: https://bugzilla.mozilla.org/show_bug.cgi?id=469377
+var strVector = new Vector.<String>;
+strVector.push("Carol", "Justine");
+strVector.unshift("Betty");
+AddTestCase(
+    "Vector.<String>.unshift()",
+    "Betty,Carol,Justine",
+    strVector.toString());
+
 test();


- bugfix: added support for alpha values for the CSS property 'color'. Due to limitations of the Flashplayers font handling, alpha can only be applied to text fields as a whole, not to individual text runs

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

--- src/reprise/controls/Label.as
+++ src/reprise/controls/Label.as
@@ -228,6 +228,14 @@
 //			}

 			m_labelDisplay.selectable = m_currentStyles.selectable;
+			if (m_currentStyles.color)
+			{
+				m_labelDisplay.alpha = m_currentStyles.color.opacity;
+			}
+			else
+			{
+				m_labelDisplay.alpha = 1;
+			}

 			m_labelDisplay.embedFonts = m_currentStyles.embedFonts;
 			m_labelDisplay.antiAliasType = m_currentStyles.antiAliasType ||


- change: removed the crappy hack that forced the parentElement to completely revalidate under certain conditions. Replaced that with invoking parent.validateAfterChildren as that really does everything needed for the use case.

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

--- src/reprise/ui/UIComponent.as
+++ src/reprise/ui/UIComponent.as
@@ -148,7 +148,6 @@
 		private var m_pseudoClassesBackup : String;
 		private var m_specifiedStyles : CSSDeclaration;
 		private var m_transitionsManager : CSSTransitionsManager;
-		private var m_skipNextValidation : Boolean;
 		private var m_scrollbarsDisplay : Sprite;
 		private var m_oldInFlowStatus : int = -1;
 		private var m_oldOuterBoxDimension : Point;
@@ -1059,11 +1058,6 @@
 			forceValidation:Boolean = false, validateStyles:Boolean = false) : void
 		{
 			m_rootElement.increaseValidatedElementsCount();
-			if (m_skipNextValidation)
-			{
-				m_skipNextValidation = false;
-				return;
-			}
 			if (validateStyles)
 			{
 				m_stylesInvalidated = true;
@@ -1237,9 +1231,7 @@
 					{
 	//					trace("w parentreflow needed in " +
 	//						m_elementType + "#"+m_cssId + "."+m_cssClasses);
-						//TODO: change this use parent.validateAfterChildren
-						m_skipNextValidation = true;
-						m_parentElement.forceRedraw();
+						UIComponent(m_parentElement).validateAfterChildren();
 						return;
 					}
 					else


Now creating multiple immediate sorters if recursion occurs.

--- WeaveCore/src/weave/utils/AsyncSort.as
+++ WeaveCore/src/weave/utils/AsyncSort.as
@@ -24,8 +24,8 @@
 	import mx.utils.ObjectUtil;

 	import weave.api.WeaveAPI;
+	import weave.api.core.ILinkableObject;
 	import weave.api.getCallbackCollection;
-	import weave.api.core.ILinkableObject;

 	/**
 	 * Asynchronous merge sort.
@@ -50,7 +50,14 @@
 				_immediateSorter = new AsyncSort();
 				_immediateSorter._immediately = true;
 			}
-			_immediateSorter.beginSort(array, compareFunction);
+
+			// temporarily set _immediateSorter to null in case sortImmediately is called recursively.
+			var sorter:AsyncSort = _immediateSorter;
+			_immediateSorter = null;
+
+			sorter.beginSort(array, compareFunction);
+
+			_immediateSorter = sorter;
 		}

 		/**


Fixed crash bug in CustomComboBox.. no longer using the hack to synchronize the dropDown with the dataProvider.

--- WeaveUI/src/weave/ui/CustomComboBox.as
+++ WeaveUI/src/weave/ui/CustomComboBox.as
@@ -19,18 +19,14 @@

 package weave.ui
 {
+	import flash.events.Event;
 	import flash.system.Capabilities;

 	import mx.collections.CursorBookmark;
-	import mx.controls.Alert;
 	import mx.controls.ComboBox;
-
-	import weave.core.ErrorManager;
-	import weave.core.SessionManager;
-	import weave.core.StageUtils;
+	import mx.events.FlexEvent;

 	/**
-	 * BUG FIX: set dataProvider() now updates drop-down list.
 	 * Added functionality: set selectedLabel()
 	 *
 	 * @author adufilie
@@ -39,42 +35,43 @@
 	{
 		public function CustomComboBox()
 		{
-			super();
-			super.dataProvider = null; // this prevents open() from crashing
-		}
-
+			super();
+		}
+
+//		/**
+//		 * This function fixes the notorious combo box bug where the
+//		 * drop-down list is out of sync with the dataProvider.
+//		 * @param value The new dataProvider.
+//		 */
+//		private function fixDropDown():void
+//		{
+//			// The dropdown will not be properly reset unless it is currently shown.
+//			if (Capabilities.isDebugger)
+//			{
+//				// when running debug player, allow the code to crash so developers take notice.
+//				// If this ever crashes, please send the stack trace to andy.dufilie@gmail.com
+//				validateNow();
+//				downArrowButton_buttonDownHandler(null);
+//			}
+//			else
+//			{
+//				// when not running debug player, ignore error
+//				try
+//				{
+//					validateNow();
+//					downArrowButton_buttonDownHandler(null);
+//				}
+//				catch (e:Error)
+//				{
+//				}
+//			}
+//		}
+
 		/**
-		 * This function fixes the notorious combo box bug where the
-		 * drop-down list is out of sync with the dataProvider.
-		 * @param value The new dataProvider.
-		 */
+		 * @inheritDoc
+		 */
 		override public function set dataProvider(value:Object):void
 		{
-			// Before calling validateNow, make sure the component is initialized.
-			// This prevents triggering creationComplete before initialization is finished.
-			if (initialized)
-			{
-				// The dropdown will not be properly reset unless it is currently shown.
-				if (Capabilities.isDebugger)
-				{
-					// when running debug player, allow the code to crash so developers take notice.
-					// If this ever crashes, please send the stack trace to andy.dufilie@gmail.com
-					validateNow();
-					downArrowButton_buttonDownHandler(null);
-				}
-				else
-				{
-					// when not running debug player, ignore error
-					try
-					{
-						validateNow();
-						downArrowButton_buttonDownHandler(null);
-					}
-					catch (e:Error)
-					{
-					}
-				}
-			}
 			super.dataProvider = value;
 		}


FLEX-33829 improve create UID performance and use New algorithm using ByteArray around 4x faster than original.

--- frameworks/projects/framework/src/mx/utils/UIDUtil.as
+++ frameworks/projects/framework/src/mx/utils/UIDUtil.as
@@ -65,16 +65,9 @@
      */
 	private static const ALPHA_CHAR_CODES:Array = [48, 49, 50, 51, 52, 53, 54,
 		55, 56, 57, 65, 66, 67, 68, 69, 70];
-
-	private static const HEX_CHARS:String = "0123456789ABCDEF";
-
-	private static var EMPTYUID:Array = [
-		'0','0','0','0','0','0','0','0',
-		'-','0','0','0','0',
-		'-','0','0','0','0',
-		'-','0','0','0','0',
-		'-','0','0','0','0','0','0','0','0','0','0','0','0'
-	];
+
+    private static const DASH:int = 45;       // dash ascii
+    private static const UIDBuffer:ByteArray = new ByteArray();       // static ByteArray used for UID generation to save memory allocation cost

     //--------------------------------------------------------------------------
     //
@@ -117,52 +110,42 @@
      *  @productversion Flex 3
      */
 	public static function createUID():String
-	{
-		var uid:Array = EMPTYUID;
-		var index:int = 0;
-
-		var i:int;
-		var j:int;
-
-		for (i = 0; i < 8; i++)
-		{
-			uid[index++] = HEX_CHARS.charAt(Math.random() * 16);
-		}
-
-		for (i = 0; i < 3; i++)
-		{
-			index++; // skip "-"
-
-			for (j = 0; j < 4; j++)
-			{
-				uid[index++] = HEX_CHARS.charAt(Math.random() * 16);
-			}
-		}
-
-		index++; // skip "-"
-
-		var time:Number = new Date().getTime();
-		// Note: time is the number of milliseconds since 1970,
-		// which is currently more than one trillion.
-		// We use the low 8 hex digits of this number in the UID.
-		// Just in case the system clock has been reset to
-		// Jan 1-4, 1970 (in which case this number could have only
-		// 1-7 hex digits), we pad on the left with 7 zeros
-		// before taking the low digits.
-		var timeString:String = ("0000000" + time.toString(16).toUpperCase()).substr(-8);
-
-		for (i = 0; i < 8; i++)
-		{
-			uid[index++] = timeString.charAt(i);
-		}
-
-		for (i = 0; i < 4; i++)
-		{
-			uid[index++] = HEX_CHARS.charAt(Math.random() * 16);
-		}
-
-		return uid.join("");
-	}
+    {
+        UIDBuffer.position = 0;
+
+        var i:int;
+        var j:int;
+
+        for (i = 0; i < 8; i++)
+        {
+            UIDBuffer.writeByte(ALPHA_CHAR_CODES[int(Math.random() * 16)]);
+        }
+
+        for (i = 0; i < 3; i++)
+        {
+            UIDBuffer.writeByte(DASH);
+            for (j = 0; j < 4; j++)
+            {
+                UIDBuffer.writeByte(ALPHA_CHAR_CODES[int(Math.random() * 16)]);
+            }
+        }
+
+        UIDBuffer.writeByte(DASH);
+
+        var time:uint = new Date().getTime(); // extract last 8 digits
+        var timeString:String = time.toString(16).toUpperCase();
+        // 0xFFFFFFFF milliseconds ~= 3 days, so timeString may have between 1 and 8 digits, hence we need to pad with 0s to 8 digits
+        for (i = 8; i > timeString.length; --i)
+            UIDBuffer.writeByte(48);
+        UIDBuffer.writeUTFBytes(timeString);
+
+        for (i = 0; i < 4; i++)
+        {
+            UIDBuffer.writeByte(ALPHA_CHAR_CODES[int(Math.random() * 16)]);
+        }
+
+        return UIDBuffer.toString();
+    }

     /**
      * Converts a 128-bit UID encoded as a ByteArray to a String representation.
@@ -188,7 +171,7 @@
             for (var i:uint = 0; i < 16; i++)
             {
                 if (i == 4 || i == 6 || i == 8 || i == 10)
-                    chars[index++] = 45; // Hyphen char code
+                    chars[index++] = DASH; // Hyphen char code

                 var b:int = ba.readByte();
                 chars[index++] = ALPHA_CHAR_CODES[(b & 0xF0) >>> 4];
@@ -227,7 +210,7 @@
                 // Check for correctly placed hyphens
                 if (i == 8 || i == 13 || i == 18 || i == 23)
                 {
-                    if (c != 45)
+                    if (c != DASH)
                     {
                         return false;
                     }


Transferred from the Adobe Open Source Subversion Repository

Revision: 5019
Author:   smgilson@adobe.com
Date:     2009-02-19T21:17:21.579153Z

Log Message:
-----------
ASDoc updates to indicate that some Halo containers do not work with the Spark equiv (ControlBar does not work with Spark Panel/AppControlBar does not work with Spark Application), and indicate that Canvas, Box, Tile, Panel have Spark equivs

QE Notes: None
Doc Notes: None
Bugs: -

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/Box.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/ApplicationControlBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/Canvas.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/Tile.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/VBox.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/Panel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/HBox.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/ViewStack.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/Accordion.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/TabNavigator.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/ControlBar.as</path>

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

--- frameworks/projects/mx/src/mx/containers/Accordion.as
+++ frameworks/projects/mx/src/mx/containers/Accordion.as
@@ -253,16 +253,21 @@
 [DefaultTriggerEvent("change")]

 /**
- *  An Accordion navigator container has a collection of child containers,
+ *  A Halo Accordion navigator container has a collection of child Halo containers,
  *  but only one of them at a time is visible.
  *  It creates and manages navigator buttons (accordion headers), which you use
  *  to navigate between the children.
- *  There is one navigator button associated with each child container,
+ *  There is one navigator button associated with each child Halo container,
  *  and each navigator button belongs to the Accordion container, not to the child.
  *  When the user clicks a navigator button, the associated child container
  *  is displayed.
  *  The transition to the new child uses an animation to make it clear to
  *  the user that one child is disappearing and a different one is appearing.
+ *
+ *
Note: The direct children of a Halo navigator container must be
+ *  Halo containers, either Halo layout or Halo navigator containers.
+ *  You cannot directly nest a control or a Spark container within a navigator;
+ *  they must be children of a child Halo container.

  *
  *
The Accordion container does not extend the ViewStack container,
  *  but it implements all the properties, methods, styles, and events


Transferred from the Adobe Open Source Subversion Repository

Revision: 6122
Author:   chaase@adobe.com
Date:     2009-04-10T14:30:17.762458Z

Log Message:
-----------
Various refactorings/renamings/changes from effects PARB review.

QE Notes: mx/effects and spark/effects currently broken (and disabled) due to these API changes. Matt is fixing.
Doc Notes: None
Bugs:
Reviewer: Hans
tests: checkintests, mustella tests/ListDataEffects

Modified Paths:
--------------
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/easing/EaseInOut.as" copyfrom-rev="5944" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/easing/EaseInOutBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/effects/effectClasses/CompositeEffectInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimateTransformMove.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/easing/EaseInOut.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/easing/EasingFraction.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/easing/Power.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/EffectEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/effects/effectClasses/ParallelInstance.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/framework/src/mx/effects/effectClasses/TweenEffectInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/FadeInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/Animate.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/animation/RepeatBehavior.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/spark-manifest.xml</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/interpolation/NumberArrayInterpolator.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimateTransformScale.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/effects/IEffect.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimateFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/Animate3DInstance.as</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimationProperty.as" copyfrom-rev="5944" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/SimpleMotionPath.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/AnimateColorInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/AnimateInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/animation/Animation.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/AnimateShaderTransitionInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/effects/EffectInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/Resize.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/AnimateFilterInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/easing/Sine.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/Rotate3DInstance.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/events/AnimationEvent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/interpolation/ArrayInterpolator.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/effects/IEffectInstance.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/flex4/src/spark/effects/supportClasses/RotateInstance.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/animation/IAnimationTarget.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/ResizeInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/MotionPath.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimationProperty.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/flex4/src/spark/effects/supportClasses/AnimateTransformInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimateTransformRotate.as</path>

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

--- frameworks/projects/spark/src/spark/effects/Rotate.as
+++ frameworks/projects/spark/src/spark/effects/Rotate.as
@@ -110,14 +110,14 @@
     //
     //--------------------------------------------------------------------------

-    // TODO: Can we remove this override? It exists only to create animationProperties,
+    // TODO: Can we remove this override? It exists only to create motionPaths,
     // which we should be able to do somewhere else
     /**
      * @private
      */
     override public function createInstance(target:Object = null):IEffectInstance
     {
-        animationProperties = [];
+        motionPaths = [];
         return super.createInstance(target);
     }


before php

before php

--- Arguments/src/classes/DynamicTextArea.as
+++ Arguments/src/classes/DynamicTextArea.as
@@ -100,10 +100,8 @@

 						currInput= forwardList[0];
 						//update the string
-
+							var s:String = "If";
 							var infPanel:Inference = Inference(panelReference);
-							var s:String = "If ";
-							//trace(infPanel.input.length);
 							for(var ind:int = 1; ind < infPanel.input.length - 1; ind++)
 							{
 								s = s + infPanel.input[ind].text + " and ";


change mime type

change mime type

--- src/MultipartTest.as
+++ src/MultipartTest.as
@@ -70,10 +70,8 @@

 			// add files
 			form.addFile("file1", test, "text/plain", "test.txt");
-			form.addFile("file2", jpg.encode(b.bitmapData), "application/octet-stream", "test.jpg");
-
-			//navigateToURL(form.request);
-
+			form.addFile("file2", jpg.encode(b.bitmapData), "image/jpeg", "test.jpg");
+
 			var loader:URLLoader = new URLLoader();
 			loader.addEventListener(Event.COMPLETE, onComplete);
 			try {


oh yeah... ant compile doesn't build the as sources... I wondered how I got this port right with no
errors on my first try.

git-svn-id: a1a4b28b82a3276cc491891159dd9963a0a72fae@4632 542714f4-19e9-0310-aa3c-eee0fc999fb1

--- src/as/com/threerings/presents/util/SafeSubscriber.as
+++ src/as/com/threerings/presents/util/SafeSubscriber.as
@@ -23,7 +23,7 @@

 import com.threerings.presents.dobj.DObject;
 import com.threerings.presents.dobj.DObjectManager;
-import com.threerings.presents.dobj.ObjectAccessException;
+import com.threerings.presents.dobj.ObjectAccessError;
 import com.threerings.presents.dobj.Subscriber;

 /**
@@ -34,7 +34,7 @@
  */
 public class SafeSubscriber implements Subscriber
 {
-    private static const log :log = log.getlog(SafeSubscriber);
+    private static const log :Log = Log.getLog(SafeSubscriber);
     /**
      * Creates a safe subscriber for the specified distributed object
      * which will interact with the specified subscriber.
@@ -118,7 +118,6 @@
                 return;
             }
             log.warning("Inactive safesub asked to unsubscribe " + this + ".");
-            Thread.dumpStack();
         }

         // note that we no longer desire to be subscribed
@@ -129,7 +128,6 @@
             if (_object != null) {
                 log.warning("Incroyable! A safesub has an object and is " +
                             "pending!? " + this + ".");
-                Thread.dumpStack();
             } else {
                 // nothing to do but wait for the subscription to complete
                 // at which point we'll pitch the object post-haste
@@ -141,7 +139,6 @@
         if (_object == null) {
             log.warning("Zut alors! A safesub _was_ active and not " +
                         "pending yet has no object!? " + this + ".");
-            Thread.dumpStack();
             // nothing to do since we're apparently already unsubscribed
             return;
         }
@@ -210,7 +207,7 @@
     /**
      * Returns a string representation of this instance.
      */
-    public function toString () :void
+    public function toString () :String
     {
         return "[oid=" + _oid + ", active=" + _active + ", pending=" + _pending + ", ]";
     }


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

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

 package spark.components.supportClasses
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 4215
Author:   shodgson@adobe.com
Date:     2008-12-02T22:44:51.740175Z

Log Message:
-----------
Bug: BLZ-276 - Getting RTE running tests that use streaming amf channel.
QA: Yes
Doc: No

Details:
* Addition of an explicit closed state to the streaming connection handler to correctly deal with client disconnects while a streaming connection may still be receiving chunked data from the server.

Modified Paths:
--------------
/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/channels/StreamingConnectionHandler.as

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

--- frameworks/projects/rpc/src/mx/messaging/channels/StreamingConnectionHandler.as
+++ frameworks/projects/rpc/src/mx/messaging/channels/StreamingConnectionHandler.as
@@ -159,6 +159,7 @@
     private static const SKIP_STATE:int = 5;
     private static const DATA_STATE:int = 6;
     private static const RESET_BUFFER_STATE:int = 7;
+    private static const CLOSED_STATE:int = 8;

     //--------------------------------------------------------------------------
     //
@@ -264,6 +265,7 @@
      */
     public function openStreamingConnection(appendToURL:String=null):void
     {
+        state = INIT_STATE;
         _appendToURL = appendToURL;

     	// Construct the streaming connection if needed.
@@ -300,7 +302,11 @@
      */
     public function closeStreamingConnection():void
     {
-        resetParserState();
+        state = CLOSED_STATE;
+        chunkBuffer = null;
+        hexChunkSize = null;
+        dataBytesToRead = -1;
+        dataOffset = 0;

     	// First, close the existing connection.
         if (streamingConnection != null)
@@ -414,18 +420,6 @@
             result += digit * powerOfSixteen;
         }
         return result;
-    }
-
-    /**
-     *  Helper method to reset parser to initial state.
-     */
-    private function resetParserState():void
-    {
-        state = INIT_STATE;
-        chunkBuffer = null;
-        hexChunkSize = null;
-        dataBytesToRead = -1;
-        dataOffset = 0;
     }

     /**
@@ -629,6 +623,11 @@
                             {
 							    channel.dispatchEvent(MessageEvent.createEvent(MessageEvent.MESSAGE, message));
                             }
+                            // We've just finsihed the one point in the parse loop where we step outside of local control.
+                            // The connection may now be closed, so check for this case here.
+                            if (state == CLOSED_STATE)
+                                return;
+
                         }
 						state = RESET_BUFFER_STATE;
                     }
@@ -659,6 +658,10 @@
                     if (chunkBuffer.bytesAvailable == 0)
                         break;
                 }
+                if (state == CLOSED_STATE)
+                {
+                    return; // Exit parse loop.
+                }
             }
         }
     }


Transferred from the Adobe Open Source Subversion Repository

Revision: 22231
Author:   chiedozi@adobe.com
Date:     2011-08-25T22:01:19.198704Z

Log Message:
-----------
Fixing an issue where the ActionBar view transition didn't properly render the last frame

QE notes:
Doc notes:
Bugs: SDK-31344
Reviewer: Evtim
Tests run:
Is noteworthy for integration: No

Modified Paths:
--------------
/private/flex/sdk/branches/4.y/frameworks/projects/mobilecomponents/src/spark/transitions/ViewTransitionBase.as

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

--- frameworks/projects/mobilecomponents/src/spark/transitions/ViewTransitionBase.as
+++ frameworks/projects/mobilecomponents/src/spark/transitions/ViewTransitionBase.as
@@ -1438,6 +1438,12 @@
     {
         effect.removeEventListener(EffectEvent.EFFECT_END, effectComplete);

+        // Validate the last frame of the actionBar animation so that it
+        // renders properly.  We put this here because layout isn't reenabled
+        // until the next frame, meaning this validation won't be applied for
+        // two frames.
+        actionBarMoveEffect_effectUpdateHandler(null);
+
         // We don't call transitionComplete just yet, we want to ensure
         // that the last frame of animation actually gets rendered on screen
         // before we clean up after ourselves.  This prevents a perceived


Issue #69: Allow strict/lenient file copy on CopyRootFileProcess.

--- src/com/esri/builder/controllers/supportClasses/processes/CopyRootFilesProcess.as
+++ src/com/esri/builder/controllers/supportClasses/processes/CopyRootFilesProcess.as
@@ -27,12 +27,14 @@
     private var sourceAppDirectory:File;
     private var destinationAppDirectory:File;
     private var rootFileNames:Array;
+    private var strict:Boolean;

-    public function CopyRootFilesProcess(sourceAppDirectory:File, destinationAppDirectory:File, rootFileNames:Array)
+    public function CopyRootFilesProcess(sourceAppDirectory:File, destinationAppDirectory:File, rootFileNames:Array, strict:Boolean = true)
     {
         this.sourceAppDirectory = sourceAppDirectory;
         this.destinationAppDirectory = destinationAppDirectory;
         this.rootFileNames = rootFileNames;
+        this.strict = strict;
     }

     override public function execute():void
@@ -59,7 +61,18 @@
     {
         var sourceFile:File = sourceAppDirectory.resolvePath(fileName);
         var destinationFile:File = destinationAppDirectory.resolvePath(fileName);
-        sourceFile.copyTo(destinationFile, true);
+
+        try
+        {
+            sourceFile.copyTo(destinationFile, true);
+        }
+        catch (e:Error)
+        {
+            if (strict || e.errorID != 3003) //file not found
+            {
+                throw e;
+            }
+        }
     }
 }
 }


Transferred from the Adobe Open Source Subversion Repository

Revision: 12850
Author:   jimurphy@adobe.com
Date:     2009-12-11T14:57:14.623098Z

Log Message:
-----------
add 6 new DMV projects to the SDK:
automation
automation_air
automation_dmv
automation_flashflexkit
automation_spark
datavisualization

These projects are setup to build in an ant main call.  There are currently several warnings in the datavisualization project that will be cleaned up.  No checkintests exist for these projects as of yet.

I also modified the exisitng projects build files for easier management of the localization targets, bundle and fat-swc. If the projects that I updated:airframework,airspark,framework,playerglobal,rpc,and spark.  All the new projects have been implemented this same way.

QE notes: DMV folks should run through their tests
Doc notes: probably
Bugs: nope
Reviewer:
Tests run: ran the following targets: compile,checkintests,other.locales and doc
Is noteworthy for integration: no

Modified Paths:
--------------
1404 paths were modified

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

--- frameworks/projects/charts/src/mx/charts/series/renderData/LineSeriesRenderData.as
+++ frameworks/projects/charts/src/mx/charts/series/renderData/LineSeriesRenderData.as
@@ -0,0 +1,140 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2009 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.charts.series.renderData
+{
+
+import mx.charts.chartClasses.RenderData;
+
+/**
+ *  Represents all the information needed by the LineSeries to render.
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public class LineSeriesRenderData extends RenderData
+{
+    include "../../../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+	/**
+	 *  Constructor.
+	 *
+	 *	@param	cache	The list of LineSeriesItem objects representing the items in the dataProvider.
+	 *	@param	filteredCache	The list of LineSeriesItem objects representing the items in the dataProvider that remain after filtering.
+	 *	@param	validPoints	The number of points in the cache that are valid.
+	 *	@param	segments	An Array of LineSeriesSegment objects representing each discontiguous segment of the LineSeries.
+	 *	@param	radius	The radius of the individual items in the LineSeries.
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public function  LineSeriesRenderData(cache:Array /* of LineSeriesItem */ = null,
+										  filteredCache:Array /* of LineSeriesItem */ = null,
+										  validPoints:Number = 0,
+										  segments:Array /* of LineSeriesSegment */ = null,
+										  radius:Number = 0)
+	{
+		super(cache, filteredCache);
+
+		this.validPoints = validPoints;
+		this.segments = segments;
+		this.radius = radius;
+	}
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+	//  radius
+    //----------------------------------
+
+	[Inspectable(environment="none")]
+
+	/**
+	 *  The radius of the individual items in the line series.
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public var radius:Number;
+
+    //----------------------------------
+	//  segments
+    //----------------------------------
+
+	[Inspectable(environment="none")]
+
+	/**
+	 *  An Array of LineSeriesSegment instances representing each discontiguous segment of the line series.
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public var segments:Array /* of LineSeriesSegment */;
+
+    //----------------------------------
+	//  validPoints
+    //----------------------------------
+
+	[Inspectable(environment="none")]
+
+	/**
+	 *  The number of points in the cache that were not filtered out by the axes.
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public var validPoints:Number;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 */
+	override public function clone():RenderData
+	{
+		var newSegments:Array /* of LineSeriesSegment */ = [];
+
+		var n:int = segments.length;
+		for (var i:int = 0; i < n; i++)
+		{
+			newSegments[i] = segments[i].clone();
+		}
+
+		return new LineSeriesRenderData(cache, filteredCache,
+										validPoints, newSegments, radius);
+	}
+}
+
+}


Transferred from the Adobe Open Source Subversion Repository

Revision: 21680
Author:   jszeto@adobe.com
Date:     2011-07-21T21:56:22.533455Z

Log Message:
-----------
Item Snapping, SpinnerList and DateSpinner Initial checkin

Merging in changes from sandbox development branch

SpinnerList and DateSpinner are in usable states, but there is still unimplemented functionality.

QE notes: none
Doc notes: none
Bugs: none
Reviewer: Tom Kraikit, Eric Day, Jason Szeto
Tests run: checkintests, full cyclone
Is noteworthy for integration: no

Modified Paths:
--------------
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile/SpinnerListSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/layouts/VerticalLayout.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/framework/src/mx/core/UIComponent.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile/DateSpinnerSkin.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobilecomponents/src/spark/components/DateAndTimeRangeList.as</path>
<path kind="dir" action="A">/private/flex/sdk/branches/4.y/development/eclipse/flex/DateSpinnerTest</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/development/eclipse/flex/DateSpinnerTest/.settings/org.eclipse.core.resources.prefs</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile/SpinnerListScrollerSkin.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/layouts/HorizontalLayout.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/ScrollSnappingMode.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/mobilecomponents/manifest.xml</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobilecomponents/src/spark/components/CalendarDate.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobilecomponents/src/spark/components/DateSelectorDisplayMode.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/layouts/TileLayout.as</path>
<path kind="dir" action="A">/private/flex/sdk/branches/4.y/development/eclipse/flex/DateSpinnerTest/.settings</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile320/assets/SpinnerListContainerBackground.fxg</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile240/assets/SpinnerListContainerBackground.fxg</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/development/eclipse/flex/DateSpinnerTest/src/DateSpinnerTest-app.xml</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/effects/ThrowEffect.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile160/assets/SpinnerListContainerBackground.fxg</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobilecomponents/src/spark/components/SpinnerListContainer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/List.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/layouts/supportClasses/LayoutBase.as</path>
<path kind="dir" action="A">/private/flex/sdk/branches/4.y/development/eclipse/flex/DateSpinnerTest/src/views</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobilecomponents/src/spark/layouts/VerticalSpinnerLayout.as</path>
<path kind="dir" action="A">/private/flex/sdk/branches/4.y/development/eclipse/flex/DateSpinnerTest/src</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/development/eclipse/flex/DateSpinnerTest/.flexProperties</path>
<path kind="dir" action="A">/private/flex/sdk/branches/4.y/development/eclipse/flex/DateSpinnerTest/libs</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/Scroller.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile/SpinnerListContainerSkin.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/development/eclipse/flex/DateSpinnerTest/.actionScriptProperties</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/bundles/en_US/components.properties</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/supportClasses/TouchScrollHelper.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile320/assets/TabbedViewNavigatorButtonBarFirstButton_down.fxg</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobilecomponents/src/spark/components/SpinnerList.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/development/eclipse/flex/DateSpinnerTest/src/DateSpinnerTest.mxml</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/development/eclipse/flex/DateSpinnerTest/src/blackberry-tablet.xml</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/development/eclipse/flex/DateSpinnerTest/src/views/DateSpinnerTestHomeView.mxml</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobilecomponents/src/spark/components/DateSpinner.as</path>
<path kind="dir" action="M">/private/flex/sdk/branches/4.y</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/defaults.css</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile320/assets/SpinnerListContainerSelectionIndicator.fxg</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile240/assets/SpinnerListContainerSelectionIndicator.fxg</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobilecomponents/src/spark/components/SpinnerListItemRenderer.as</path>
<path kind="dir" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobilecomponents/.settings</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile160/assets/SpinnerListContainerSelectionIndicator.fxg</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/MobileThemeClasses.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/development/eclipse/flex/DateSpinnerTest/.project</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile320/assets/SpinnerListContainerShadow.fxg</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile240/assets/SpinnerListContainerShadow.fxg</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile160/assets/SpinnerListContainerShadow.fxg</path>

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

--- frameworks/projects/spark/src/spark/components/supportClasses/TouchScrollHelper.as
+++ frameworks/projects/spark/src/spark/components/supportClasses/TouchScrollHelper.as
@@ -0,0 +1,878 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2011 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package spark.components.supportClasses
+{
+import flash.display.DisplayObject;
+import flash.events.Event;
+import flash.events.MouseEvent;
+import flash.events.TimerEvent;
+import flash.events.TouchEvent;
+import flash.geom.Point;
+import flash.system.Capabilities;
+import flash.utils.Timer;
+
+import mx.core.UIComponent;
+import mx.core.mx_internal;
+import mx.events.SandboxMouseEvent;
+import mx.events.TouchInteractionEvent;
+import mx.events.TouchInteractionReason;
+import mx.utils.GetTimerUtil;
+
+use namespace mx_internal;
+
+[ExcludeClass]
+
+/**
+ *  @private
+ *  Helper class to handle some of the touch scrolling logic.  Specifically
+ *  it is used to handle some of the mouse tracking and velocity calculations.
+ */
+public class TouchScrollHelper
+{
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class constants
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Number of mouse movements to keep in the history to calculate
+     *  velocity.
+     */
+    private static const EVENT_HISTORY_LENGTH:int = 5;
+
+    /**
+     *  @private
+     *  Minimum velocity needed to start a throw gesture, in inches per second.
+     */
+    private static const MIN_START_VELOCITY_IPS:Number = 0.8;
+
+    /**
+     *  @private
+     *  Maximum velocity of throw effect, in inches per second.
+     */
+    private static const MAX_THROW_VELOCITY_IPS:Number = 10.0;
+
+    /**
+     *  @private
+     *  Weights to use when calculating velocity, giving the last velocity more of a weight
+     *  than the previous ones.
+     */
+    private static const VELOCITY_WEIGHTS:Vector.<Number> = Vector.<Number>([1, 1.33, 1.66, 2]);
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor
+     */
+    public function TouchScrollHelper()
+    {
+        super();
+
+        isIOS = (Capabilities.version.indexOf("IOS") == 0);
+
+        mouseEventCoordinatesHistory = new Vector.<Point>(EVENT_HISTORY_LENGTH);
+        mouseEventTimeHistory = new Vector.<int>(EVENT_HISTORY_LENGTH);
+    }
+
+
+    /**
+     *  @private
+     *  A callback that is invoked when a drag is in progress
+     *  and there's a new pixel delta.
+     */
+    mx_internal var dragFunction:Function = null;
+
+    /**
+     *  @private
+     *  A callback that is invoked when the drag part of the
+     *  touch gesture is over (mouse up was received), and
+     *  a throw may be necessary.
+     */
+    mx_internal var throwFunction:Function = null;
+
+    /**
+     *  @private
+     *  The component on which the touch interaction events are dispatched.
+     */
+    mx_internal var target:UIComponent;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  scrollSlop - the scrolling threshold (minimum number of
+     *  pixels needed to move before a scroll gesture is recognized
+     */
+    private var scrollSlop:Number;
+
+
+    /**
+     *  @private
+     *  The point that was moused downed on for this scroll gesture
+     */
+    private var mouseDownedPoint:Point;
+
+    /**
+     *  @private
+     *  The displayObject that was mousedowned on.
+     */
+    private var mouseDownedDisplayObject:DisplayObject;
+
+    /**
+     *  @private
+     *  The point that a scroll was recognized from.
+     *
+     *
This is different from mouseDownedPoint because the user may
+     *  mousedown on one point, but a scroll isn't recognized until
+     *  they move more than the slop.  Because of this, we don't want
+     *  the delta scrolled to be calculated from the mouseDowned point
+     *  because that would look jerky the first time a scroll occurred.

+     */
+    private var scrollGestureAnchorPoint:Point;
+
+    /**
+     *  @private
+     *  The delta coordinates of the most recent mouse event during a drag gesture
+     */
+    private var mostRecentDragDeltaX:Number;
+    private var mostRecentDragDeltaY:Number;
+
+    /**
+     *  @private
+     *  The time of the most recent mouse event during a drag gesture
+     */
+    private var mostRecentDragTime:Number;
+
+    /**
+     *  @private
+     *  Timer used to do drag scrolling.
+     */
+    private var dragTimer:Timer = null;
+
+    /**
+     *  @private
+     *  Indicates that the mouse coordinates have changed and the
+     *  next dragTimer invokation needs to do a scroll.
+     */
+    private var dragScrollPending:Boolean = false;
+
+    /**
+     *  @private
+     *  The time the scroll started
+     */
+    private var startTime:Number;
+
+    /**
+     *  @private
+     *  Keeps track of the coordinates where the mouse events
+     *  occurred.  We use this for velocity calculation along
+     *  with timeHistory.
+     */
+    private var mouseEventCoordinatesHistory:Vector.<Point>;
+
+    /**
+     *  @private
+     *  Length of items in the mouseEventCoordinatesHistory and
+     *  timeHistory Vectors since a circular buffer is used to
+     *  conserve points.
+     */
+    private var mouseEventLength:Number = 0;
+
+    /**
+     *  @private
+     *  A history of times the last few mouse events occurred.
+     *  We keep HISTORY objects in memory, and we use this mouseEventTimeHistory
+     *  Vector along with mouseEventCoordinatesHistory to determine the velocity
+     *  a user was moving their fingers.
+     */
+    private var mouseEventTimeHistory:Vector.<int>;
+
+    /**
+     *  @private
+     *  Whether we are currently in a scroll gesture or not.
+     */
+    private var isScrolling:Boolean;
+
+    /**
+     *  @private
+     *  Indicates whether we're running on an iOS device
+     */
+    private var isIOS:Boolean = false;
+
+    /**
+     *  @private
+     *  This determines the maximum rate at which the "dragFunction"
+     *  callback will be invoked (aka "event thinning). A value of
+     *  NaN means that callbacks will be delivered as quickly as possible.
+     */
+    private var maxScrollRate:Number = NaN;
+
+    /**
+     *  @private
+     *  True if we should watch for scrolling on the horizontal axis.
+     */
+    private var canScrollHorizontally:Boolean;
+
+    /**
+     *  @private
+     *  True if we should watch for scrolling on the vertical axis.
+     */
+    private var canScrollVertically:Boolean;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Starts watching for a scroll operation.  This should take either
+     *  MouseEvent.MOUSE_DOWN or TouchEvent.TOUCH_BEGIN, but for now, only
+     *  mousedown works.
+     */
+    mx_internal function startScrollWatch(
+        event:Event,
+        canScrollHorizontally:Boolean = true,
+        canScrollVertically:Boolean = true,
+        slop:Number = 0,
+        maxScrollRate:Number = NaN):void
+    {
+        // this is the point from which all deltas are based.
+        startTime = GetTimerUtil.getTimer();
+        this.scrollSlop = slop;
+        this.maxScrollRate = maxScrollRate;
+        this.canScrollHorizontally = canScrollHorizontally;
+        this.canScrollVertically = canScrollVertically;
+
+        if (event is MouseEvent && event.type == MouseEvent.MOUSE_DOWN)
+        {
+            var mouseEvent:MouseEvent = event as MouseEvent;
+
+            if (!isScrolling)
+            {
+                this.mouseDownedDisplayObject = mouseEvent.target as DisplayObject;
+
+                mouseDownedPoint = new Point(mouseEvent.stageX, mouseEvent.stageY);
+            }
+
+            installMouseListeners();
+
+            // if we were already scrolling, continue scrolling
+            if (isScrolling)
+            {
+                scrollGestureAnchorPoint = new Point(mouseEvent.stageX, mouseEvent.stageY);
+                mouseDownedPoint = new Point(mouseEvent.stageX, mouseEvent.stageY);
+            }
+
+            // reset circular buffer index/length
+            mouseEventLength = 0;
+
+            addMouseEventHistory(mouseEvent.stageX, mouseEvent.stageY, GetTimerUtil.getTimer());
+        }
+        else if (event is TouchEvent && event.type == TouchEvent.TOUCH_BEGIN)
+        {
+            // TouchEvent case
+            // TODO (rfrishbe)
+        }
+    }
+
+    /**
+     *  @private
+     *  Starts watching for a scroll operation.
+     */
+    mx_internal function stopScrollWatch():void
+    {
+        uninstallMouseListeners();
+    }
+
+    /**
+     *  @private
+     *  Adds the time and mouse coordinates for this event in to
+     *  our mouse event history so that we can use it later to
+     *  calculate velocity.
+     *
+     *  @return the delta moved between this mouse event and the start
+     *          of the scroll gesture.
+     */
+    private function addMouseEventHistory(stageX:Number, stageY:Number, time:Number):Point
+    {
+        // calculate dx, dy
+        var dx:Number = stageX - mouseDownedPoint.x;
+        var dy:Number = stageY - mouseDownedPoint.y;
+
+        // either use a Point object already created or use one already created
+        // in mouseEventCoordinatesHistory
+        var currentPoint:Point;
+        var currentIndex:int = (mouseEventLength % EVENT_HISTORY_LENGTH);
+        if (mouseEventCoordinatesHistory[currentIndex])
+        {
+            currentPoint = mouseEventCoordinatesHistory[currentIndex];
+            currentPoint.x = dx;
+            currentPoint.y = dy;
+        }
+        else
+        {
+            currentPoint = new Point(dx, dy);
+            mouseEventCoordinatesHistory[currentIndex] = currentPoint;
+        }
+
+        // add time history as well
+
+        // Using the passed-in "time" value is more accurate than querying the timer here, as the
+        // delta coordinates may have been captured a while ago (i.e. in the event thinning
+        // timer handler).  However, I'm only making this change for iOS right now in order
+        // to reduce risk at the end of the 4.5.1 release.
+        // TODO (eday):  Change this to use the passed-in time for all platforms.
+        mouseEventTimeHistory[currentIndex] = isIOS ? (time - startTime) : (GetTimerUtil.getTimer() - startTime);
+
+        // increment current length if appropriate
+        mouseEventLength ++;
+
+        return currentPoint;
+    }
+
+    /**
+     *  @private
+     *  Installs mouse listeners to determine how far we've moved.
+     */
+    private function installMouseListeners():void
+    {
+        var sbRoot:DisplayObject = target.systemManager.getSandboxRoot();
+
+        sbRoot.addEventListener(MouseEvent.MOUSE_MOVE, sbRoot_mouseMoveHandler, true);
+        sbRoot.addEventListener(MouseEvent.MOUSE_UP, sbRoot_mouseUpHandler, true);
+        sbRoot.addEventListener(SandboxMouseEvent.MOUSE_UP_SOMEWHERE, sbRoot_mouseUpHandler);
+
+        target.systemManager.deployMouseShields(true);
+    }
+
+    /**
+     *  @private
+     */
+    private function uninstallMouseListeners():void
+    {
+        var sbRoot:DisplayObject = target.systemManager.getSandboxRoot();
+
+        // mouse events added in installMouseListeners()
+        sbRoot.removeEventListener(MouseEvent.MOUSE_MOVE, sbRoot_mouseMoveHandler, true);
+        sbRoot.removeEventListener(MouseEvent.MOUSE_UP, sbRoot_mouseUpHandler, true);
+        sbRoot.removeEventListener(SandboxMouseEvent.MOUSE_UP_SOMEWHERE, sbRoot_mouseUpHandler);
+
+        target.systemManager.deployMouseShields(false);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Event handlers
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  If we are not scrolling, this is used to determine whether we should start
+     *  scrolling or not by checking if we've moved more than the slop.
+     *  If we are scrolling, this is used to call dragFunction callback
+     *  and to determine how far the user has scrolled.
+     */
+    private function sbRoot_mouseMoveHandler(event:MouseEvent):void
+    {
+        var mouseDownedDifference:Point =
+            new Point(event.stageX - mouseDownedPoint.x, event.stageY - mouseDownedPoint.y);
+
+        if (!isScrolling)
+        {
+            var shouldBeScrolling:Boolean = false;
+
+            // now figure out if we should scroll horizontally or vertically based on our slop
+            if (canScrollHorizontally && Math.abs(mouseDownedDifference.x) >= scrollSlop)
+                shouldBeScrolling = true;
+            if (canScrollVertically && Math.abs(mouseDownedDifference.y) >= scrollSlop)
+                shouldBeScrolling = true;
+
+            // If we should be scrolling, start scrolling
+            if (shouldBeScrolling)
+            {
+                // Dispatch a cancellable and bubbling event to notify others
+                var scrollStartingEvent:TouchInteractionEvent = new TouchInteractionEvent(TouchInteractionEvent.TOUCH_INTERACTION_STARTING, true, true);
+                scrollStartingEvent.relatedObject = target;
+                scrollStartingEvent.reason = TouchInteractionReason.SCROLL;
+                var eventAccepted:Boolean = dispatchBubblingEventOnMouseDownedDisplayObject(scrollStartingEvent);
+
+                // if the event was preventDefaulted(), then stop scrolling scrolling
+                if (!eventAccepted)
+                {
+                    // TODO (rfrishbe): do we need to call updateAfterEvent() here and below?
+                    event.updateAfterEvent();
+
+                    // calling stopScrollWatch() will remove all the appropriate listeners
+                    stopScrollWatch();
+
+                    return;
+                }
+
+                // if the event has been accepted, then dispatch a bubbling start event
+                var scrollStartEvent:TouchInteractionEvent = new TouchInteractionEvent(TouchInteractionEvent.TOUCH_INTERACTION_START, true, true);
+                scrollStartEvent.relatedObject = target;
+                scrollStartEvent.reason = TouchInteractionReason.SCROLL;
+                dispatchBubblingEventOnMouseDownedDisplayObject(scrollStartEvent);
+
+                isScrolling = true;
+
+                // now that we're scrolling, calculate the scrollAnchorPoint.
+                // There are three cases: diagonal, horizontal, and vertical.
+                // if (0,0) is where you mouseDowned, (10,10) is where you are at now.  Then mouseDownedDiff is (10, 10)
+                // scrollAnchorPoint is calculated as where we "crossed the threshold" in to scrolling territory.
+                // so we figure out if they scrolled up, down, right, left (or a combination of that for
+                // the diagonal case).
+                if (canScrollHorizontally && canScrollVertically)
+                {
+                    // diagonal case
+                    var maxAxisDistance:Number = Math.max(Math.abs(mouseDownedDifference.x), Math.abs(mouseDownedDifference.y));
+                    if (maxAxisDistance >= scrollSlop)
+                    {
+                        var scrollAnchorDiffX:int;
+                        var scrollAnchorDiffY:int;
+
+                        // The anchor point is the point at which the line described by mouseDownedDifference
+                        // intersects with the perimeter of the slop area.  The slop area is a square with sides
+                        // of length scrollSlop*2.
+                        var normalizedDiff:Point = mouseDownedDifference.clone();
+
+                        // Use the ratio of scrollSlop to maxAxisDistance to determine the length of the line
+                        // from the mouse down point to the anchor point.
+                        var lineLength:Number = (scrollSlop / maxAxisDistance) * mouseDownedDifference.length;
+
+                        // Normalize to create a line of that length with the same angle it had before.
+                        normalizedDiff.normalize(lineLength);
+
+                        // 4 possibilities: top-right, top-left, bottom-right, bottom-left
+                        scrollAnchorDiffX = Math.round(normalizedDiff.x);
+                        scrollAnchorDiffY = Math.round(normalizedDiff.y);
+
+                        scrollGestureAnchorPoint = new Point(mouseDownedPoint.x + scrollAnchorDiffX,
+                            mouseDownedPoint.y + scrollAnchorDiffY);
+                    }
+                }
+                else if (canScrollHorizontally)
+                {
+                    // horizontal case
+                    if (mouseDownedDifference.x >= scrollSlop)
+                        scrollGestureAnchorPoint = new Point(mouseDownedPoint.x + scrollSlop, mouseDownedPoint.y);
+                    else
+                        scrollGestureAnchorPoint = new Point(mouseDownedPoint.x - scrollSlop, mouseDownedPoint.y);
+                }
+                else if (canScrollVertically)
+                {
+                    // vertical case
+                    if (mouseDownedDifference.y >= scrollSlop)
+                        scrollGestureAnchorPoint = new Point(mouseDownedPoint.x, mouseDownedPoint.y + scrollSlop);
+                    else
+                        scrollGestureAnchorPoint = new Point(mouseDownedPoint.x, mouseDownedPoint.y - scrollSlop);
+                }
+
+                // velocity calculations come from mouseDownedPoint.  The drag ones com from scrollStartPoint.
+                // This seems fine.
+            }
+        }
+
+        // if we are scrolling (even if we just started scrolling)
+        if (isScrolling)
+        {
+            // calculate the delta
+            var dx:Number = event.stageX - scrollGestureAnchorPoint.x;
+            var dy:Number = event.stageY - scrollGestureAnchorPoint.y;
+
+            if (!dragTimer)
+            {
+                // The logic in this code requires that we create a timer with
+                // a valid rate even if the specified rate is NaN and the timer
+                // won't actually be used.
+                var rate:Number = isNaN(maxScrollRate) ? 30 : maxScrollRate;
+                dragTimer = new Timer(1000/rate, 0);
+                dragTimer.addEventListener(TimerEvent.TIMER, dragTimerHandler);
+            }
+
+            if (!dragTimer.running)
+            {
+                // The drag timer is not running, so we record the event and scroll
+                // the content immediately.
+                addMouseEventHistory(event.stageX, event.stageY, GetTimerUtil.getTimer());
+                if (dragFunction != null)
+                    dragFunction(dx, dy);
+
+                // Call updateAfterEvent() to make sure it looks smooth
+                event.updateAfterEvent();
+
+                // If event thinning is not enabled, we never start the timer so all subsequent
+                // move event will continue to be handled right in this function.
+                if (!isNaN(maxScrollRate))
+                {
+                    // Start the periodic timer that will do subsequent drag
+                    // scrolling if necessary.
+                    dragTimer.start();
+
+                    // No additional mouse events received yet, so no scrolling pending.
+                    dragScrollPending = false;
+                }
+            }
+            else
+            {
+                // The drag timer is running, so we just save the delta coordinates
+                // and indicate that a scroll is pending.
+                mostRecentDragDeltaX = dx;
+                mostRecentDragDeltaY = dy;
+                mostRecentDragTime = GetTimerUtil.getTimer();
+                dragScrollPending = true;
+            }
+        }
+    }
+
+    /**
+     *  @private
+     *  Used to periodically scroll during a drag gesture
+     */
+    private function dragTimerHandler(event:TimerEvent):void
+    {
+        if (dragScrollPending)
+        {
+            // A scroll is pending, so record the mouse deltas and scroll the content.
+            addMouseEventHistory(
+                mostRecentDragDeltaX + scrollGestureAnchorPoint.x,
+                mostRecentDragDeltaY + scrollGestureAnchorPoint.y, mostRecentDragTime);
+            if (dragFunction != null)
+                dragFunction(mostRecentDragDeltaX, mostRecentDragDeltaY);
+
+            // Call updateAfterEvent() to make sure it looks smooth
+            event.updateAfterEvent();
+
+            // No scroll is pending now.
+            dragScrollPending = false;
+        }
+        else
+        {
+            // The timer elapsed with no mouse events, so we'll
+            // just turn the timer off for now.  It will get turned
+            // back on if another mouse event comes in.
+            dragTimer.stop();
+        }
+    }
+
+    /**
+     *  @private
+     *  Called when the user releases the mouse/touches up
+     */
+    private function sbRoot_mouseUpHandler(event:Event):void
+    {
+        uninstallMouseListeners();
+
+        // If we weren't already scrolling, then let's not start scrolling now
+        if (!isScrolling)
+            return;
+
+        if (dragTimer)
+        {
+            if (dragScrollPending)
+            {
+                // A scroll is pending, so record the mouse deltas and scroll
+                // the content.
+                addMouseEventHistory(
+                    mostRecentDragDeltaX + scrollGestureAnchorPoint.x,
+                    mostRecentDragDeltaY + scrollGestureAnchorPoint.y, mostRecentDragTime);
+                if (dragFunction != null)
+                    dragFunction(mostRecentDragDeltaX, mostRecentDragDeltaY);
+
+                // Call updateAfterEvent() to make sure it looks smooth
+                if (event is MouseEvent)
+                    MouseEvent(event).updateAfterEvent();
+            }
+
+            // The drag gesture is over, so we no longer need the timer.
+            dragTimer.stop();
+            dragTimer.removeEventListener(TimerEvent.TIMER, dragTimerHandler);
+            dragTimer = null;
+        }
+
+        // Note that on iOS we essentially ignore the delta position and time of the mouseUp event.
+        // This is because this last event seems to not reliably track with the actual velocity of the
+        // gesture, and causes problem for our velocity calculation.
+        // TODO (eday): determine the right cross-platform approach here.
+        // We check for "MouseEvent" because this could be a SanboxMouseEvent
+        if (!isIOS && event is MouseEvent)
+            addMouseEventHistory(MouseEvent(event).stageX, MouseEvent(event).stageY, GetTimerUtil.getTimer());
+
+        // decide about throw
+
+        // pad click and timeHistory if needed
+        var currentTime:Number = GetTimerUtil.getTimer();
+
+        // calculate average time b/w events and see if the last two (mouseMove and this mouseUp)
+        // were far apart.  If they were, then don't do anything if the velocity of them is small.
+        var averageDt:Number = 0;
+        var len:int = (mouseEventLength > EVENT_HISTORY_LENGTH ? EVENT_HISTORY_LENGTH : mouseEventLength);
+
+        // if haven't wrapped around, then startIndex = 0.  If we've wrapped around,
+        // then startIndex = mouseEventLength % EVENT_HISTORY_LENGTH.  The equation
+        // below handles both of those cases
+        const startIndex:int = ((mouseEventLength - len) % EVENT_HISTORY_LENGTH);
+        const endIndex:int = ((mouseEventLength - 1) % EVENT_HISTORY_LENGTH);
+
+        // gauranteed to have 2 mouse events b/c atleast a mousedown and a mousemove
+        // because if there was no mousemove, we definitely would not be scrolling and
+        // would have exited this function earlier
+        var currentIndex:int = startIndex;
+        while (currentIndex != endIndex)
+        {
+            // calculate nextIndex here so we can use it in the calculations
+            var nextIndex:int = ((currentIndex + 1) % EVENT_HISTORY_LENGTH);
+
+            averageDt += mouseEventTimeHistory[nextIndex] - mouseEventTimeHistory[currentIndex];
+
+            currentIndex = nextIndex;
+        }
+        averageDt /= len-1;
+
+        var minVelocityPixels:Number = MIN_START_VELOCITY_IPS * Capabilities.screenDPI / 1000;
+
+        // calculate the velocity using a weighted average
+        var throwVelocity:Point = calculateThrowVelocity();
+
+        // Also calculate the effective velocity for the final 100ms of the drag.
+        var finalDragVel:Point = calculateFinalDragVelocity(100);
+
+        // On iOS, we use the final 100ms of the drag to determine the velocity.
+        // TODO (eday): arrive at a velocity-calculation scheme that works across platforms.
+        if (isIOS)
+            throwVelocity = finalDragVel;
+
+        if (throwVelocity.length <= minVelocityPixels)
+        {
+            throwVelocity.x = 0;
+            throwVelocity.y = 0;
+        }
+
+        // If the gesture appears to have slowed or stopped prior to the mouse up,
+        // then force the velocity to zero.
+        // Compare the final 100ms of the drag to the minimum value.
+        if ( finalDragVel.length <= minVelocityPixels)
+        {
+            throwVelocity.x = 0;
+            throwVelocity.y = 0;
+        }
+
+        // Note that we always call the throw function - even when the velocity is zero.
+        // This is needed because we may be past the end of the list and need an
+        // animation to get us back.
+        if (throwFunction != null)
+            throwFunction(throwVelocity.x, throwVelocity.y);
+    }
+
+    /**
+     *  @private
+     *  Helper function to calculate the current throwVelocity().
+     *
+     *
It calculates the velocities and then calculates a weighted
+     *  average from them.

+     */
+    private function calculateThrowVelocity():Point
+    {
+        var len:int = (mouseEventLength > EVENT_HISTORY_LENGTH ? EVENT_HISTORY_LENGTH : mouseEventLength);
+
+        // we are guarenteed to have 2 items here b/c of mouseDown and a mouseMove
+
+        // if haven't wrapped around, then startIndex = 0.  If we've wrapped around,
+        // then startIndex = mouseEventLength % EVENT_HISTORY_LENGTH.  The equation
+        // below handles both of those cases
+        const startIndex:int = ((mouseEventLength - len) % EVENT_HISTORY_LENGTH);
+        const endIndex:int = ((mouseEventLength - 1) % EVENT_HISTORY_LENGTH);
+
+        // variables to store a running average
+        var weightedSumX:Number = 0;
+        var weightedSumY:Number = 0;
+        var totalWeight:Number = 0;
+
+        var currentIndex:int = startIndex;
+        var i:int = 0;
+        while (currentIndex != endIndex)
+        {
+            // calculate nextIndex early so we can re-use it for these calculations
+            var nextIndex:int = ((currentIndex + 1) % EVENT_HISTORY_LENGTH);
+
+            // Get dx, dy, and dt
+            var dt:Number = mouseEventTimeHistory[nextIndex] - mouseEventTimeHistory[currentIndex];
+            var dx:Number = mouseEventCoordinatesHistory[nextIndex].x - mouseEventCoordinatesHistory[currentIndex].x;
+            var dy:Number = mouseEventCoordinatesHistory[nextIndex].y - mouseEventCoordinatesHistory[currentIndex].y;
+
+            if (dt != 0)
+            {
+                // calculate a weighted sum for velocities
+                weightedSumX += (dx/dt) * VELOCITY_WEIGHTS[i];
+                weightedSumY += (dy/dt) * VELOCITY_WEIGHTS[i];
+                totalWeight += VELOCITY_WEIGHTS[i];
+            }
+
+            currentIndex = nextIndex;
+            i++;
+        }
+
+        if (totalWeight == 0)
+            return new Point(0, 0);
+
+        // Limit the velocity to an absolute maximum
+        var maxPixelsPerMS:Number = MAX_THROW_VELOCITY_IPS * Capabilities.screenDPI / 1000;
+        var velX:Number = Math.min(maxPixelsPerMS, Math.max(-maxPixelsPerMS, weightedSumX/totalWeight));
+        var velY:Number = Math.min(maxPixelsPerMS, Math.max(-maxPixelsPerMS, weightedSumY/totalWeight));
+
+        return new Point(velX, velY);
+    }
+
+    /**
+     *  @private
+     *  Helper function to calculate the velocity of the touch drag
+     *  for its final time milliseconds.
+     */
+    private function calculateFinalDragVelocity(time:Number):Point
+    {
+        // This function is similar to calculateThrowVelocity with the
+        // following differences:
+        // 1) It iterates backwards through the mouse events.
+        // 2) It stops when the specified amount of time is accounted for.
+        // 3) It calculates the velocities from the overall deltas with no
+        //    weighting or averaging.
+
+        // Find the range of mouse events to consider
+        var len:int = (mouseEventLength > EVENT_HISTORY_LENGTH ? EVENT_HISTORY_LENGTH : mouseEventLength);
+        const startIndex:int = ((mouseEventLength - len) % EVENT_HISTORY_LENGTH);
+        const endIndex:int = ((mouseEventLength - 1) % EVENT_HISTORY_LENGTH);
+
+        // We're going to start at the last event of the drag and iterate
+        // backward toward the first.
+        var currentIndex:int = endIndex;
+
+        var dt:Number = 0;
+        var dx:Number = 0;
+        var dy:Number = 0;
+
+        // Loop until we've accounted for the desired amount of time or run out of events.
+        while (time > 0 && currentIndex != startIndex)
+        {
+            // Find the index of the previous event
+            var previousIndex:int = currentIndex - 1;
+            if (previousIndex < 0)
+                previousIndex += EVENT_HISTORY_LENGTH;
+
+            // Calculate time and position deltas between the two events
+            var _dt:Number = mouseEventTimeHistory[currentIndex] - mouseEventTimeHistory[previousIndex];
+            var _dx:Number = mouseEventCoordinatesHistory[currentIndex].x - mouseEventCoordinatesHistory[previousIndex].x;
+            var _dy:Number = mouseEventCoordinatesHistory[currentIndex].y - mouseEventCoordinatesHistory[previousIndex].y;
+
+            // If the deltas exceed our desired time range, interpolate by scaling them
+            if (_dt > time)
+            {
+                var interpFraction:Number = time/_dt;
+                _dx *= interpFraction;
+                _dy *= interpFraction;
+                _dt = time;
+            }
+
+            // Subtract the current time delta from the overall desired time range
+            time -= _dt;
+
+            // Accumulate the deltas
+            dt += _dt;
+            dx += _dx;
+            dy += _dy;
+
+            // Go to the previous event in the drag
+            currentIndex = previousIndex;
+        }
+
+        if (dt == 0)
+            return new Point(0, 0);
+
+        if (isIOS)
+        {
+            // On iOS, we use this function to determine the throw velocity.  So we need to enforce
+            // the same maximum velocity as calculateThrowVelocity.
+            // TODO (eday): make all this stuff platform-independent.
+            var maxPixelsPerMS:Number = MAX_THROW_VELOCITY_IPS * Capabilities.screenDPI / 1000;
+            var velX:Number = Math.min(maxPixelsPerMS, Math.max(-maxPixelsPerMS, dx/dt));
+            var velY:Number = Math.min(maxPixelsPerMS, Math.max(-maxPixelsPerMS, dy/dt));
+            return new Point(velX, velY);
+        }
+
+        // Create the point representing the velocity values.
+        return new Point(dx/dt, dy/dt);
+    }
+
+    /**
+     *  @private
+     *  Helper method to dispatch bubbling events on mouseDownDisplayObject.  Since this
+     *  object can be off the display list, this may be tricky.  Technically, we should
+     *  grab all the live objects at the time of mouseDown and dispatch events to them
+     *  manually, but instead, we just use this heuristic, which is dispatch it to
+     *  mouseDownedDisplayObject.  If it's not inside of target and off the display list,
+     *  then dispatch to target as well.
+     *
+     *
If you absolutely need to know the touch event ended, add event listeners
+     *  to the mouseDownedDisplayObject directly and don't rely on event
+     *  bubbling.

+     */
+    private function dispatchBubblingEventOnMouseDownedDisplayObject(event:Event):Boolean
+    {
+        var eventAccepted:Boolean = true;
+        if (mouseDownedDisplayObject)
+        {
+            eventAccepted = eventAccepted && mouseDownedDisplayObject.dispatchEvent(event);
+            if (!mouseDownedDisplayObject.stage)
+            {
+                if (target && !target.contains(mouseDownedDisplayObject))
+                    eventAccepted = eventAccepted && target.dispatchEvent(event);
+            }
+        }
+        else
+        {
+            eventAccepted = eventAccepted && target.dispatchEvent(event);
+        }
+
+        return eventAccepted;
+    }
+
+    /**
+     *  @private
+     *  When the touchScrollThrow is over, we should dispatch a touchInteractionEnd.
+     */
+    mx_internal function endTouchScroll():void
+    {
+        if (isScrolling)
+        {
+            isScrolling = false;
+
+            var scrollEndEvent:TouchInteractionEvent = new TouchInteractionEvent(TouchInteractionEvent.TOUCH_INTERACTION_END, true);
+            scrollEndEvent.relatedObject = target;
+            scrollEndEvent.reason = TouchInteractionReason.SCROLL;
+            dispatchBubblingEventOnMouseDownedDisplayObject(scrollEndEvent);
+        }
+    }
+}
+}


get basic tooltip up

get basic tooltip up

--- frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/accessories/ToolTipBead.as
+++ frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/accessories/ToolTipBead.as
@@ -18,17 +18,20 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.html.accessories
 {
-	import flash.events.MouseEvent;
+	import flash.display.DisplayObject;
+    import flash.events.MouseEvent;
+	import flash.geom.Point;
 	import flash.text.TextFieldType;

 	import org.apache.flex.core.IBead;
+	import org.apache.flex.core.IPopUpHost;
 	import org.apache.flex.core.IStrand;
-    import org.apache.flex.core.IPopUpHost;
+	import org.apache.flex.core.IUIBase;
 	import org.apache.flex.core.UIBase;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
-    import org.apache.flex.html.ToolTip;
-    import org.apache.flex.utils.UIUtils;
+	import org.apache.flex.html.ToolTip;
+	import org.apache.flex.utils.UIUtils;

 	/**
 	 *  The ToolTipBead class is a specialty bead that can be used with
@@ -100,8 +103,14 @@
 		{
             IEventDispatcher(_strand).addEventListener(MouseEvent.ROLL_OUT, rollOutHandler);

-            host = UIUtils.findPopUpHost(_strand as UIBase);
+            var comp:IUIBase = _strand as IUIBase
+            host = UIUtils.findPopUpHost(comp);
             tt = new ToolTip();
+            tt.text = toolTip;
+            var pt:Point = new Point(comp.width, comp.height);
+            pt = DisplayObject(comp).localToGlobal(pt);
+            tt.x = pt.x;
+            tt.y = pt.y;
             host.addElement(tt);
 		}


Transferred from the Adobe Open Source Subversion Repository

Revision: 7756
Author:   rfrishbe@adobe.com
Date:     2009-06-11T21:28:48.623739Z

Log Message:
-----------
Some PARB changes for SkinnableComponent and DataGroup:

SkinnableComponent.invalidateSkinState() changed from protected to public

DataGroup:
initializeDataProvider(): protected -> private
addItemRendererToDisplayList(): protected -> private
dataProvider_collectionChangeHandler(): protected -> mx_internal
adjustAfterAdd(): protected -> private
adjustAfterRemove(): protected -> private
adjustAfterMove(): protected -> private
adjustAfterReplace(): protected -> private

QE Notes: -
Doc Notes: -
Bugs: -
Reviewer: F10
tests: checkintest (seem to fail due to local changes to ScrollBar, which I'm not checking in here)

Modified Paths:
--------------
<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/components/RadioButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/SkinnableComponent.as</path>

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

--- frameworks/projects/spark/src/spark/components/supportClasses/SkinnableComponent.as
+++ frameworks/projects/spark/src/spark/components/supportClasses/SkinnableComponent.as
@@ -508,7 +508,7 @@
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
-    protected function invalidateSkinState():void
+    public function invalidateSkinState():void
     {
         if (skinStateIsDirty)
             return; // State is already invalidated


[FWR-j9J3LsxC] MicrophoneLevelForwarder: minor improvements

--- src/main/flashwavrecorder/MicrophoneLevelForwarder.as
+++ src/main/flashwavrecorder/MicrophoneLevelForwarder.as
@@ -8,19 +8,15 @@

   public class MicrophoneLevelForwarder extends EventDispatcher implements IMicrophoneEventForwarder {

-    private var sampleCalculator:SampleCalculator;
+    private var _sampleCalculator:SampleCalculator;

     public function MicrophoneLevelForwarder(sampleCalculator:SampleCalculator) {
-      this.sampleCalculator = sampleCalculator;
+      _sampleCalculator = sampleCalculator;
     }

     public function handleMicSampleData(event:SampleDataEvent):void {
-      var levelValue:Number = sampleCalculator.getHighestSample(ByteArray(event.data));
-      dispatchLevelEvent(levelValue);
-    }
-
-    private function dispatchLevelEvent(level:Number):void {
-      dispatchEvent(new MicrophoneLevelEvent(level));
+      var levelValue:Number = _sampleCalculator.getHighestSample(ByteArray(event.data));
+      dispatchEvent(new MicrophoneLevelEvent(levelValue));
     }

   }


Transferred from the Adobe Open Source Subversion Repository

Revision: 17425
Author:   rfrishbe@adobe.com
Date:     2010-08-20T17:29:56.448841Z

Log Message:
-----------
Pretty basic refactoring for PARB (though it is a lot of files).  Renamed GestureCaptureEvent/GestureCaptureReason (these were previously TouchScrollEvent) to TouchInteractionEvent/TouchInteractionReason.  inputMode has been renamed to interactionMode and has a new enumeration class, mx.core.InteractionMode.

There's on non-PARB change that was made was in List and mobiletheme/defaults.css. I found a bug in that the item renderer wasn't highlighting on mousedown anymore. There were two issues at play. Firstly the touchDelay was set to 100 ms in the Scroller only, so I added it to List and added a FIXME comment to myself figuring out if the code in List should use scroller.getStyle("touchDelay") or itemRenderer.getStyle("touchDelay") instead of getStyle("touchDelay"). Also, I found out that the code doesn't deal with touchDelay=0 very well. Since we're planning on working on this code anyways (and possibly moving it in to ItemRenderer itself with a new downstate), I just put in a hack with a FIXME to handle this case for now.

QE notes: None
Doc notes: None
Bugs: -
Reviewer: Jason SJ, Chiedo
Tests run: checkintests
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="D">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/events/GestureCaptureEvent.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/core/InteractionMode.as</path>
<path kind="file" action="D">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/events/GestureCaptureReason.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/MobileItemRenderer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/defaults.css</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/List.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/skins/spark/DefaultItemRenderer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/defaults.css</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/ScrollerLayout.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/ItemRenderer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/tools/dependencychecker/flex/tools/dependencychecker/FrameworkSwcDependencyRules.java</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/FrameworkClasses.as</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/events/GestureCaptureEvent.as" copyfrom-rev="17393" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/events/TouchInteractionEvent.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/core/UIComponent.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/Scroller.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/TrackBase.as</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/events/GestureCaptureReason.as" copyfrom-rev="17393" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/events/TouchInteractionReason.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableTextBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBase.as</path>

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

--- frameworks/projects/framework/src/FrameworkClasses.as
+++ frameworks/projects/framework/src/FrameworkClasses.as
@@ -66,6 +66,7 @@
 	import mx.core.ISelectableList; ISelectableList;
 	import mx.core.ISystemCursorClient; ISystemCursorClient;
 	import mx.core.ITextInput; ITextInput;
+    import mx.core.InteractionMode; InteractionMode;
 	import mx.core.IUID; IUID;
 	import mx.core.MovieClipAsset; MovieClipAsset;
 	import mx.core.MovieClipLoaderAsset; MovieClipLoaderAsset;
@@ -85,8 +86,8 @@
     import mx.events.IndexChangedEvent; IndexChangedEvent;
 	import mx.events.ItemClickEvent; ItemClickEvent;
 	import mx.events.ModuleEvent; ModuleEvent;
-    import mx.events.GestureCaptureEvent; GestureCaptureEvent;
-    import mx.events.GestureCaptureReason; GestureCaptureReason;
+    import mx.events.TouchInteractionEvent; TouchInteractionEvent;
+    import mx.events.TouchInteractionReason; TouchInteractionReason;
 	import mx.filters.BaseFilter; BaseFilter;
 	import mx.filters.BaseDimensionFilter; BaseDimensionFilter;
 	import mx.filters.IBitmapFilter; IBitmapFilter;


Transferred from the Adobe Open Source Subversion Repository

Revision: 3411
Author:   egeorgie@adobe.com
Date:     2008-09-29T23:44:01.337941Z

Log Message:
-----------
* Change layout-related width/height, explicit width/height, measured width/height properties from post-scale to pre-transform. yay!
* Flex3 containers are updated to support the new behavior.
* Repeatedly scaling a component can differ from before, since we no longer accumulate rounding errors.
* The change is gated by a version flag, in compatibility mode these properties don't change.

Reviewed by Glenn, Ely

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/utilityClasses/BoxLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/Box.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/utilityClasses/CanvasLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/Tile.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/utilityClasses/PostScaleAdapter.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/containers/DividedBox.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/containers/FormItem.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/flex/layout/LayoutItemUIC.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/Container.as</path>

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

--- frameworks/projects/mx/src/mx/containers/Accordion.as
+++ frameworks/projects/mx/src/mx/containers/Accordion.as
@@ -1112,7 +1112,7 @@
         for (var i:int = 0; i < n; i++)
         {
             var button:Button = getHeaderAt(i);
-            var child:IUIComponent = IUIComponent(getChildAt(i));
+            var child:IUIComponent = getLayoutChildAt(i);

             minWidth = Math.max(minWidth, button.minWidth);
             minHeight += headerHeight;
@@ -1231,7 +1231,7 @@
         for (var i:int = 0; i < n; i++)
         {
             var header:Button = getHeaderAt(i);
-            var content:IUIComponent = IUIComponent(getChildAt(i));
+            var content:IUIComponent = getLayoutChildAt(i);

             header.move(x, y);
             header.setActualSize(localContentWidth, headerHeight);


Transferred from the Adobe Open Source Subversion Repository

Revision: 7036
Author:   jimurphy@adobe.com
Date:     2009-05-18T16:23:35.783417Z

Log Message:
-----------
Merged 3.x revisions 6955,6995,6997-7002 -> trunk

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/Application.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/NavBar.as</path>
<path kind="dir" action="M">/flex/sdk/trunk</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/RichTextEditor.mxml</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/framework/src/mx/skins/halo/ToolTipBorder.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/rpc/src/mx/rpc/xml/SchemaMarshaller.as</path>

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

--- frameworks/projects/mx/src/mx/containers/Accordion.as
+++ frameworks/projects/mx/src/mx/containers/Accordion.as
@@ -2372,6 +2372,10 @@
         var oldIndex:int = selectedIndex;
         var newIndex:int;
         var index:int = getChildIndex(child);
+
+        // Remove Event Listeners, in case children are referenced elsewhere.
+        child.removeEventListener("labelChanged", labelChangedHandler);
+        child.removeEventListener("iconChanged",  iconChangedHandler);

         var nChildren:int = numChildren - 1;
             // number of children remaining after child has been removed