flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcl...@apache.org
Subject git commit: [flex-sdk] [refs/heads/develop] - FLEX-33913 fix for lists getting mixed up
Date Sat, 04 Jan 2014 01:57:22 GMT
Updated Branches:
  refs/heads/develop 9f8aab867 -> 59dd2be7f


FLEX-33913 fix for lists getting mixed up


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/59dd2be7
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/59dd2be7
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/59dd2be7

Branch: refs/heads/develop
Commit: 59dd2be7f6a9b0fda745249cf979adeac7f406b7
Parents: 9f8aab8
Author: Justin Mclean <jmclean@apache.org>
Authored: Sat Jan 4 12:55:53 2014 +1100
Committer: Justin Mclean <jmclean@apache.org>
Committed: Sat Jan 4 12:55:53 2014 +1100

----------------------------------------------------------------------
 .../src/mx/collections/XMLListAdapter.as        | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/59dd2be7/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as b/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as
index 4de1af0..17d2173 100644
--- a/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as
+++ b/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as
@@ -246,14 +246,18 @@ public class XMLListAdapter extends EventDispatcher implements IList,
IXMLNotifi
         	
 		setBusy();
 
-    	//e4x doesn't provide an insertion operator so you tend to do
-    	//addition.  if we're inserting at the first item we you add
-    	//the old 1st to the new one.  if inserting in the middle or end
-    	//you just add to the one before
-        if (index == 0)
-            source[0] = length > 0 ? item + source[0] : item;
-        else
-            source[index - 1] += item;
+		if (length > 0)
+		{
+			var localLength:uint = source.length();
+			
+			// Adjust all indexes by 1
+			for (var i:uint = localLength; i>index; i--)
+			{
+				source[i] = source[i - 1];
+			}
+		}
+		
+		source[index] = item;
 
         startTrackUpdates(item, seedUID + uidCounter.toString());
 		uidCounter++;


Mime
View raw message