<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>SnippetRepoBrowser</title>
    <link>http://snippet.gnstudio.com/snippetrepobrowser/index</link>    
    <description>RSS Feed of SnippetRepoBrowser (Global RSS)</description>    
    <language>en-us</language>
    <pubDate>Thu, 09 Feb 2012 21:28:02 +0100</pubDate>
    <docs>SnippetRepoBrowser/index</docs>
    <generator>SnippetRepoBrowser Feed Generator</generator>
    <item>
      <title><![CDATA[Edit multiple items in sorted ArrayCollection]]></title>
      <link>http://snippet.gnstudio.com/viewtopic/15</link>
      <description><![CDATA[<span style="font-family:arial"><span style="font-size: 10pt">Do following if you want to traverse through sorted ArrayCollection, update multiple items and trigger only one collection change event to optimize performance of components that use the collection.</span></span><br />&lt;!--<br />		@page { margin: 2cm }<br />		P { margin-bottom: 0.21cm }<br />	--&gt;<br />]]><![CDATA[<div class="divcode"><pre lang="actionscript">var collection:ArrayCollection = new ArrayCollection();<br /><br />collection.addItem({bar:&quot;bar1&quot;, foo:1});<br />collection.addItem({bar:&quot;bar2&quot;, foo:2});<br />collection.addItem({bar:&quot;bar3&quot;, foo:3});<br />collection.addItem({bar:&quot;bar4&quot;, foo:4});<br /><br />var sort:Sort = new Sort();<br />sort.fields = [new SortField(&quot;foo&quot;)];<br /><br />collection.sort = sort;<br />collection.refresh();<br /><br />collection.addEventListener(CollectionEvent.COLLECTION_CHANGE, function(e:CollectionEvent):void {<br />	<br />	trace(e.type);<br />	<br />});<br /><br />collection.disableAutoUpdate();<br />			<br />var cursor:IViewCursor = collection.createCursor();<br /><br />while (!cursor.afterLast) {<br />	<br />	cursor.current.foo++;<br />	<br />	cursor.view.itemUpdated(cursor.current);<br />	<br />	cursor.moveNext();<br />	<br />}<br /><br />collection.enableAutoUpdate();</pre></div><br /><br />]]></description>
      <author>ivan.varga</author>
      <pubDate>Fri, 04 Sep 2009 00:05:34 +0200</pubDate>
      <category>ActionScript</category>
      <guid>http://snippet.gnstudio.com/viewtopic/15</guid>
   </item>
  </channel>
</rss>
