<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: For-each-in loops in ActionScript 3</title>
	<atom:link href="http://www.barklund.org/blog/2009/05/21/for-each-in-loops-in-actionscript-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.barklund.org/blog/2009/05/21/for-each-in-loops-in-actionscript-3/</link>
	<description>work smarter when building current web trends</description>
	<lastBuildDate>Wed, 23 Nov 2011 11:48:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
	<item>
		<title>By: tyler</title>
		<link>http://www.barklund.org/blog/2009/05/21/for-each-in-loops-in-actionscript-3/comment-page-1/#comment-147511</link>
		<dc:creator>tyler</dc:creator>
		<pubDate>Mon, 14 Nov 2011 19:37:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.barklund.org/blog/?p=84#comment-147511</guid>
		<description>I got a compiler error in your first example. It seems &#039;items&#039; and &#039;index&#039; are reserved words. 

1151: A conflict exists with definition items in namespace internal.

changed these and everything worked fine.</description>
		<content:encoded><![CDATA[<p>I got a compiler error in your first example. It seems &#8216;items&#8217; and &#8216;index&#8217; are reserved words. </p>
<p>1151: A conflict exists with definition items in namespace internal.</p>
<p>changed these and everything worked fine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bas</title>
		<link>http://www.barklund.org/blog/2009/05/21/for-each-in-loops-in-actionscript-3/comment-page-1/#comment-145009</link>
		<dc:creator>bas</dc:creator>
		<pubDate>Thu, 17 Mar 2011 14:43:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.barklund.org/blog/?p=84#comment-145009</guid>
		<description>please use xmllist. it&#039;s super handy!</description>
		<content:encoded><![CDATA[<p>please use xmllist. it&#8217;s super handy!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barklund</title>
		<link>http://www.barklund.org/blog/2009/05/21/for-each-in-loops-in-actionscript-3/comment-page-1/#comment-142721</link>
		<dc:creator>Barklund</dc:creator>
		<pubDate>Mon, 17 Jan 2011 21:28:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.barklund.org/blog/?p=84#comment-142721</guid>
		<description>Hi Zwaf,

For each is not a generic iterator method for iterating over contents of a collection (like loops in Java or Python). It is &lt;strong&gt;only&lt;/strong&gt; possible to use for iterating over all members of a basic object that is as close to being array-like as they come.

If you have the need for iterating over your children, just manually maintain a list of them and you can iterate all you like :)</description>
		<content:encoded><![CDATA[<p>Hi Zwaf,</p>
<p>For each is not a generic iterator method for iterating over contents of a collection (like loops in Java or Python). It is <strong>only</strong> possible to use for iterating over all members of a basic object that is as close to being array-like as they come.</p>
<p>If you have the need for iterating over your children, just manually maintain a list of them and you can iterate all you like :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zwaf</title>
		<link>http://www.barklund.org/blog/2009/05/21/for-each-in-loops-in-actionscript-3/comment-page-1/#comment-141856</link>
		<dc:creator>Zwaf</dc:creator>
		<pubDate>Sun, 26 Dec 2010 09:48:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.barklund.org/blog/?p=84#comment-141856</guid>
		<description>Not sure whether I&#039;m bumping up an old topic but this is just about the only reference to for-each loops in AS3 I can find on google.

Why does for-each looping not work for children of displayObject

for each(var child:Sprite in childContainer)
{
removeChild(child);
}

I know the alternative is iterating through all children (i=0;i&lt;numChildren;i++) and a removeChildAt but this does not work for me as the index of the container is messed up (a child might be on 2 and none on 0) which will cause this procedure to throw errors. 
Plus that &#039;for each&#039; looks much more elegant to me.

Thanks in advance</description>
		<content:encoded><![CDATA[<p>Not sure whether I&#8217;m bumping up an old topic but this is just about the only reference to for-each loops in AS3 I can find on google.</p>
<p>Why does for-each looping not work for children of displayObject</p>
<p>for each(var child:Sprite in childContainer)<br />
{<br />
removeChild(child);<br />
}</p>
<p>I know the alternative is iterating through all children (i=0;i&lt;numChildren;i++) and a removeChildAt but this does not work for me as the index of the container is messed up (a child might be on 2 and none on 0) which will cause this procedure to throw errors.<br />
Plus that &#039;for each&#039; looks much more elegant to me.</p>
<p>Thanks in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg</title>
		<link>http://www.barklund.org/blog/2009/05/21/for-each-in-loops-in-actionscript-3/comment-page-1/#comment-130154</link>
		<dc:creator>Greg</dc:creator>
		<pubDate>Thu, 24 Jun 2010 15:28:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.barklund.org/blog/?p=84#comment-130154</guid>
		<description>You can use dynamic typing in a for each in loop by setting your type to *. For example:

var arry:Array = [&quot;1&quot;, 2, &quot;3&quot;];

for each (var item:* in array)
{
   if (item is String)
   {
      trace(&quot;String value is: &quot; + item);
   }
   else if (item is Number)
   {
      trace(&quot;Number value is: &quot; + item);
   }
}

// returns
// String value is: 1
// Number value is: 2
// String value is: 3</description>
		<content:encoded><![CDATA[<p>You can use dynamic typing in a for each in loop by setting your type to *. For example:</p>
<p>var arry:Array = ["1", 2, "3"];</p>
<p>for each (var item:* in array)<br />
{<br />
   if (item is String)<br />
   {<br />
      trace(&#8220;String value is: &#8221; + item);<br />
   }<br />
   else if (item is Number)<br />
   {<br />
      trace(&#8220;Number value is: &#8221; + item);<br />
   }<br />
}</p>
<p>// returns<br />
// String value is: 1<br />
// Number value is: 2<br />
// String value is: 3</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Semester 2 - Week 2: AS3 Properties, Methods and Events « Flash Uni</title>
		<link>http://www.barklund.org/blog/2009/05/21/for-each-in-loops-in-actionscript-3/comment-page-1/#comment-81381</link>
		<dc:creator>Semester 2 - Week 2: AS3 Properties, Methods and Events « Flash Uni</dc:creator>
		<pubDate>Tue, 04 Aug 2009 06:32:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.barklund.org/blog/?p=84#comment-81381</guid>
		<description>[...] http://www.barklund.org/blog/2009/05/21/for-each-in-loops-in-actionscript-3/ [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://www.barklund.org/blog/2009/05/21/for-each-in-loops-in-actionscript-3/" rel="nofollow">http://www.barklund.org/blog/2009/05/21/for-each-in-loops-in-actionscript-3/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Top 6 AS3 features you miss when switching back to AS2 &#124; Barklund.org</title>
		<link>http://www.barklund.org/blog/2009/05/21/for-each-in-loops-in-actionscript-3/comment-page-1/#comment-80476</link>
		<dc:creator>Top 6 AS3 features you miss when switching back to AS2 &#124; Barklund.org</dc:creator>
		<pubDate>Sun, 19 Jul 2009 21:41:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.barklund.org/blog/?p=84#comment-80476</guid>
		<description>[...] latter category includes e.g. the for-each-in construct, different number types, class introspection or built-in class look-up by string, but these are my [...]</description>
		<content:encoded><![CDATA[<p>[...] latter category includes e.g. the for-each-in construct, different number types, class introspection or built-in class look-up by string, but these are my [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
