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 <jmcl...@apache.org>
Authored: Sat Jan 4 12:55:53 2014 +1100
Committer: Justin Mclean <jmcl...@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++;

Reply via email to