Repository: flex-sdk Updated Branches: refs/heads/FLEX-34283 [created] e780eaa81
Now XMLListCollection behaves closer to be expected -- does not update parent from updated XMLList. I guess it should be debated wether it should... Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/e780eaa8 Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/e780eaa8 Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/e780eaa8 Branch: refs/heads/FLEX-34283 Commit: e780eaa814b5ac76e9dbfc88208f88022b57c5f4 Parents: 79073bf Author: Nick Kwiatkowski <[email protected]> Authored: Mon May 19 19:18:15 2014 -0400 Committer: Nick Kwiatkowski <[email protected]> Committed: Mon May 19 19:18:15 2014 -0400 ---------------------------------------------------------------------- .../src/mx/collections/XMLListAdapter.as | 32 ++++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/e780eaa8/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 17d2173..7c29798 100644 --- a/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as +++ b/frameworks/projects/framework/src/mx/collections/XMLListAdapter.as @@ -248,16 +248,30 @@ public class XMLListAdapter extends EventDispatcher implements IList, IXMLNotifi 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]; - } + var newSource:XMLList = new XMLList(); + + for (var i:uint = 0; i <= (length); i++) + { + if (i < index) + { + newSource[i] = source[i]; + } + else if (i == index) + { + newSource[i] = item; + } + else if (i > index) + { + newSource[i] = source[i-1]; + } + } + + source = newSource; } - - source[index] = item; + else + { + source[index] = item; + } startTrackUpdates(item, seedUID + uidCounter.toString()); uidCounter++;
