<?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: AS3 for&#8230;in Object does not behave like AS2</title>
	<atom:link href="http://www.stevensacks.net/2008/04/07/as3-forin-object-does-not-behave-like-as2/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stevensacks.net/2008/04/07/as3-forin-object-does-not-behave-like-as2/</link>
	<description>Adobe, Flash, Flex, AIR, Technology</description>
	<lastBuildDate>Wed, 28 Jul 2010 13:21:51 -0700</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
	<item>
		<title>By: Joe Wheeler</title>
		<link>http://www.stevensacks.net/2008/04/07/as3-forin-object-does-not-behave-like-as2/comment-page-1/#comment-8363</link>
		<dc:creator>Joe Wheeler</dc:creator>
		<pubDate>Mon, 23 Feb 2009 13:42:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevensacks.net/?p=88#comment-8363</guid>
		<description>Actually even in AS2 the order of iteration of a for...in loop is unpredictable. Try using it on a sorted Array and you&#039;ll see what I mean. Check the documentation too, it&#039;s mentioned in there.</description>
		<content:encoded><![CDATA[<p>Actually even in AS2 the order of iteration of a for&#8230;in loop is unpredictable. Try using it on a sorted Array and you&#039;ll see what I mean. Check the documentation too, it&#039;s mentioned in there.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Kamerman</title>
		<link>http://www.stevensacks.net/2008/04/07/as3-forin-object-does-not-behave-like-as2/comment-page-1/#comment-1951</link>
		<dc:creator>Steve Kamerman</dc:creator>
		<pubDate>Wed, 02 Jul 2008 19:40:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevensacks.net/?p=88#comment-1951</guid>
		<description>To get a similar effect in AS3 you need to use an Array of objects, like this:

var data:Array = [
  {a: 1},
  {b: 2},
  {c: 3}
];

for (var i:uint=0;i&lt;data.length;i++){
  var obj:Object = data[i];
  var s:String;
  for(s in obj){break;} //set s

  trace(s + &quot; = &quot; + obj[s]);
}</description>
		<content:encoded><![CDATA[<p>To get a similar effect in AS3 you need to use an Array of objects, like this:</p>
<p>var data:Array = [<br />
  {a: 1},<br />
  {b: 2},<br />
  {c: 3}<br />
];</p>
<p>for (var i:uint=0;i&lt;data.length;i++){<br />
  var obj:Object = data[i];<br />
  var s:String;<br />
  for(s in obj){break;} //set s</p>
<p>  trace(s + &#034; = &#034; + obj[s]);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: calvin</title>
		<link>http://www.stevensacks.net/2008/04/07/as3-forin-object-does-not-behave-like-as2/comment-page-1/#comment-1780</link>
		<dc:creator>calvin</dc:creator>
		<pubDate>Tue, 24 Jun 2008 18:50:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevensacks.net/?p=88#comment-1780</guid>
		<description>I agree that the main problem in as3 is the fact that you can only iterate over genuine Object objects...
Even casting to Object doesnt work..so there is a LOSS of functionality here. I wish I knew a workround this was quite an elegant way of doing something which now I see no solution but to engineer a specific array or other.</description>
		<content:encoded><![CDATA[<p>I agree that the main problem in as3 is the fact that you can only iterate over genuine Object objects&#8230;<br />
Even casting to Object doesnt work..so there is a LOSS of functionality here. I wish I knew a workround this was quite an elegant way of doing something which now I see no solution but to engineer a specific array or other.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philip Thonbo</title>
		<link>http://www.stevensacks.net/2008/04/07/as3-forin-object-does-not-behave-like-as2/comment-page-1/#comment-1661</link>
		<dc:creator>Philip Thonbo</dc:creator>
		<pubDate>Fri, 30 May 2008 14:37:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevensacks.net/?p=88#comment-1661</guid>
		<description>what about the fact that you in as2 could use displayObjects(movieclips) and whatever to run a for(i in this)
on. and it would return EVERYTHING incl [type Function] script objects visible objects everything - you could trace a mc.filters[0] to get vars from a filter object created in flash ide - [object BlurFilter] now you can ONLY iterate through an strict Object object - it is so lame tell me if you find  any work around on THAT</description>
		<content:encoded><![CDATA[<p>what about the fact that you in as2 could use displayObjects(movieclips) and whatever to run a for(i in this)<br />
on. and it would return EVERYTHING incl [type Function] script objects visible objects everything &#8211; you could trace a mc.filters[0] to get vars from a filter object created in flash ide &#8211; [object BlurFilter] now you can ONLY iterate through an strict Object object &#8211; it is so lame tell me if you find  any work around on THAT</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: corban baxter</title>
		<link>http://www.stevensacks.net/2008/04/07/as3-forin-object-does-not-behave-like-as2/comment-page-1/#comment-1417</link>
		<dc:creator>corban baxter</dc:creator>
		<pubDate>Fri, 11 Apr 2008 16:27:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevensacks.net/?p=88#comment-1417</guid>
		<description>its things like this that make me want to never be a &quot;REAL&quot; programmer!</description>
		<content:encoded><![CDATA[<p>its things like this that make me want to never be a &#034;REAL&#034; programmer!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Keesey</title>
		<link>http://www.stevensacks.net/2008/04/07/as3-forin-object-does-not-behave-like-as2/comment-page-1/#comment-1379</link>
		<dc:creator>Mike Keesey</dc:creator>
		<pubDate>Mon, 07 Apr 2008 23:33:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevensacks.net/?p=88#comment-1379</guid>
		<description>If your code relies on order, you should not be using for ... in, anyway. The language&#039;s &quot;contract&quot;, so to speak, does not guarantee any particular order.

Java&#039;s collections make the distinction a little more explicit: most Collection objects don&#039;t guarantee any order, but the List subinterface does.</description>
		<content:encoded><![CDATA[<p>If your code relies on order, you should not be using for &#8230; in, anyway. The language&#039;s &#034;contract&#034;, so to speak, does not guarantee any particular order.</p>
<p>Java&#039;s collections make the distinction a little more explicit: most Collection objects don&#039;t guarantee any order, but the List subinterface does.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: michal</title>
		<link>http://www.stevensacks.net/2008/04/07/as3-forin-object-does-not-behave-like-as2/comment-page-1/#comment-1378</link>
		<dc:creator>michal</dc:creator>
		<pubDate>Mon, 07 Apr 2008 22:57:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevensacks.net/?p=88#comment-1378</guid>
		<description>My guess would be that the implementation uses a hash table for both object properties and the Dictionary. This would guarantee fast O(1) inserts/searches but do not provide any reasonable ordering which is exactly what you&#039;re seeing.
The alternative is a tree set which would provide alphabetical ordering of keys at the cost of slower O(log(n)) inserts/searches.
I&#039;m not sure what tests you did in Java as it gives you explicit choice of HashMap and TreeMap depending on your needs. 
The rule of thumb I was taught: unless you need the ordering use the hash set asd it&#039;s faster. So they did in AS3 I guess.
I&#039;m trying to think how you&#039;d get first in/first out ordering on a dictionary and I can only come up with a list of key/value pairs which is extremely inefficient for anything other than inserts.</description>
		<content:encoded><![CDATA[<p>My guess would be that the implementation uses a hash table for both object properties and the Dictionary. This would guarantee fast O(1) inserts/searches but do not provide any reasonable ordering which is exactly what you&#039;re seeing.<br />
The alternative is a tree set which would provide alphabetical ordering of keys at the cost of slower O(log(n)) inserts/searches.<br />
I&#039;m not sure what tests you did in Java as it gives you explicit choice of HashMap and TreeMap depending on your needs.<br />
The rule of thumb I was taught: unless you need the ordering use the hash set asd it&#039;s faster. So they did in AS3 I guess.<br />
I&#039;m trying to think how you&#039;d get first in/first out ordering on a dictionary and I can only come up with a list of key/value pairs which is extremely inefficient for anything other than inserts.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
