<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Where is IList.addAll() in AS3/Flex?</title>
	<atom:link href="http://www.techper.net/2008/05/26/where-is-ilistaddall-in-as3flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.techper.net/2008/05/26/where-is-ilistaddall-in-as3flex/</link>
	<description>About Technology in My Life</description>
	<pubDate>Mon, 01 Dec 2008 17:18:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
		<item>
		<title>By: Danny Gold</title>
		<link>http://www.techper.net/2008/05/26/where-is-ilistaddall-in-as3flex/#comment-908</link>
		<dc:creator>Danny Gold</dc:creator>
		<pubDate>Sat, 31 May 2008 18:03:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.techper.net/2008/05/26/where-is-ilistaddall-in-as3flex/#comment-908</guid>
		<description>Roland's method is the best way to achieve the "addAll" functionality using the current collections API. calling addItem() in a loop will result in firing any Bindings each iteration through the loop which could be a huge performance hit. By setting the source property of the AC and using concat, you're modifying the underlying Array and the Bindings will only fire once you call collection.refresh();</description>
		<content:encoded><![CDATA[<p>Roland&#8217;s method is the best way to achieve the &#8220;addAll&#8221; functionality using the current collections API. calling addItem() in a loop will result in firing any Bindings each iteration through the loop which could be a huge performance hit. By setting the source property of the AC and using concat, you&#8217;re modifying the underlying Array and the Bindings will only fire once you call collection.refresh();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: polesen</title>
		<link>http://www.techper.net/2008/05/26/where-is-ilistaddall-in-as3flex/#comment-874</link>
		<dc:creator>polesen</dc:creator>
		<pubDate>Tue, 27 May 2008 19:32:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.techper.net/2008/05/26/where-is-ilistaddall-in-as3flex/#comment-874</guid>
		<description>@Roland Zwaga: Works too, thanks.</description>
		<content:encoded><![CDATA[<p>@Roland Zwaga: Works too, thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Theo</title>
		<link>http://www.techper.net/2008/05/26/where-is-ilistaddall-in-as3flex/#comment-869</link>
		<dc:creator>Theo</dc:creator>
		<pubDate>Tue, 27 May 2008 16:30:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.techper.net/2008/05/26/where-is-ilistaddall-in-as3flex/#comment-869</guid>
		<description>Yeah, Set's are important, that's why I mentioned them twice, oh wait, three times now.</description>
		<content:encoded><![CDATA[<p>Yeah, Set&#8217;s are important, that&#8217;s why I mentioned them twice, oh wait, three times now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Theo</title>
		<link>http://www.techper.net/2008/05/26/where-is-ilistaddall-in-as3flex/#comment-868</link>
		<dc:creator>Theo</dc:creator>
		<pubDate>Tue, 27 May 2008 16:29:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.techper.net/2008/05/26/where-is-ilistaddall-in-as3flex/#comment-868</guid>
		<description>I'd vote for anything that brought us a proper collections API, because mx.collections sure ain't one.

I'd like a nice Set implementation, as well as a more thought-through API. In the Java collection API you can actually program to the interface types, but in Flex you have to type everything as ArrayCollection to be able to do any useful work without casting from IList to ICollectionView and back again. And how come IList is mutable, but ICollectionView is not? And why is there no Set implementation?</description>
		<content:encoded><![CDATA[<p>I&#8217;d vote for anything that brought us a proper collections API, because mx.collections sure ain&#8217;t one.</p>
<p>I&#8217;d like a nice Set implementation, as well as a more thought-through API. In the Java collection API you can actually program to the interface types, but in Flex you have to type everything as ArrayCollection to be able to do any useful work without casting from IList to ICollectionView and back again. And how come IList is mutable, but ICollectionView is not? And why is there no Set implementation?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roland Zwaga</title>
		<link>http://www.techper.net/2008/05/26/where-is-ilistaddall-in-as3flex/#comment-867</link>
		<dc:creator>Roland Zwaga</dc:creator>
		<pubDate>Tue, 27 May 2008 15:44:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.techper.net/2008/05/26/where-is-ilistaddall-in-as3flex/#comment-867</guid>
		<description>How about this then?

var collection:ArrayCollection = new ArrayCollection([1,2,3,4,5]);
var toAdd:ArrayCollection = new ArrayCollection([6,7,8,9,10]);
collection.source = collection.source.concat(toAdd.source);</description>
		<content:encoded><![CDATA[<p>How about this then?</p>
<p>var collection:ArrayCollection = new ArrayCollection([1,2,3,4,5]);<br />
var toAdd:ArrayCollection = new ArrayCollection([6,7,8,9,10]);<br />
collection.source = collection.source.concat(toAdd.source);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: polesen</title>
		<link>http://www.techper.net/2008/05/26/where-is-ilistaddall-in-as3flex/#comment-865</link>
		<dc:creator>polesen</dc:creator>
		<pubDate>Tue, 27 May 2008 12:00:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.techper.net/2008/05/26/where-is-ilistaddall-in-as3flex/#comment-865</guid>
		<description>Oops, lordy, that didn't work. When doing the splice, the last argument (ArrB) is added as one element of type array. Taking the length of the array afterwards shows this, even though tracing it shows something else.

I ended up with this:

&lt;code&gt;
        var sourceArray:Array = collection.source;
        toAdd.forEach(function(element:*, index:int, arr:Array) : void {
            sourceArray.push(element);
        });
        collection.refresh();
&lt;/code&gt;

About the events. I added myself as a CollectionEvent.COLLECTION_CHANGE listener, and I only got event on the refresh.</description>
		<content:encoded><![CDATA[<p>Oops, lordy, that didn&#8217;t work. When doing the splice, the last argument (ArrB) is added as one element of type array. Taking the length of the array afterwards shows this, even though tracing it shows something else.</p>
<p>I ended up with this:</p>
<p><code><br />
        var sourceArray:Array = collection.source;<br />
        toAdd.forEach(function(element:*, index:int, arr:Array) : void {<br />
            sourceArray.push(element);<br />
        });<br />
        collection.refresh();<br />
</code></p>
<p>About the events. I added myself as a CollectionEvent.COLLECTION_CHANGE listener, and I only got event on the refresh.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: polesen</title>
		<link>http://www.techper.net/2008/05/26/where-is-ilistaddall-in-as3flex/#comment-864</link>
		<dc:creator>polesen</dc:creator>
		<pubDate>Tue, 27 May 2008 05:31:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.techper.net/2008/05/26/where-is-ilistaddall-in-as3flex/#comment-864</guid>
		<description>Thanks lordy.</description>
		<content:encoded><![CDATA[<p>Thanks lordy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lordy</title>
		<link>http://www.techper.net/2008/05/26/where-is-ilistaddall-in-as3flex/#comment-859</link>
		<dc:creator>Lordy</dc:creator>
		<pubDate>Mon, 26 May 2008 21:21:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.techper.net/2008/05/26/where-is-ilistaddall-in-as3flex/#comment-859</guid>
		<description>Try this
ColA = ArrayCollection
ArrB = Array

var tempArr:Array = ColA.source;
tempArr.splice(-1,0,ArrB);
ColA.refresh();

You'd be better of doing this then call additem for each item. As it will send out a property change event each time, or generating a new arraycollection.</description>
		<content:encoded><![CDATA[<p>Try this<br />
ColA = ArrayCollection<br />
ArrB = Array</p>
<p>var tempArr:Array = ColA.source;<br />
tempArr.splice(-1,0,ArrB);<br />
ColA.refresh();</p>
<p>You&#8217;d be better of doing this then call additem for each item. As it will send out a property change event each time, or generating a new arraycollection.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
