<?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: ArrayCollection.getItemAt() doesn&#8217;t return null</title>
	<atom:link href="http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null/feed" rel="self" type="application/rss+xml" />
	<link>http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null</link>
	<description>Ruben Swieringa on Actionscript and a whole lot of other stuff..</description>
	<lastBuildDate>Wed, 14 Jul 2010 10:22:27 +0200</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Patrick</title>
		<link>http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null/comment-page-1#comment-92327</link>
		<dc:creator>Patrick</dc:creator>
		<pubDate>Wed, 30 Sep 2009 21:07:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null#comment-92327</guid>
		<description>wow, two years and the docs are still wrong.  :(  They could&#039;ve at least given us a &quot;containsItemAt&quot; function to match the &quot;contains&quot; function so we don&#039;t need to rely on wonky exception handling.</description>
		<content:encoded><![CDATA[<p>wow, two years and the docs are still wrong.  <img src='http://www.rubenswieringa.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />   They could&#8217;ve at least given us a &#8220;containsItemAt&#8221; function to match the &#8220;contains&#8221; function so we don&#8217;t need to rely on wonky exception handling.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ruben</title>
		<link>http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null/comment-page-1#comment-52402</link>
		<dc:creator>Ruben</dc:creator>
		<pubDate>Fri, 29 Aug 2008 07:28:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null#comment-52402</guid>
		<description>Hey Carl,

[quote comment=&quot;52268&quot;]What DOES it return?[/quote]

Well it doesn&#039;t really return anything, the getItemAt()-method is canceled and the error is thrown. If you would set the returned value to a variable called &lt;em&gt;&#039;someValue&#039;&lt;/em&gt; and test the value after having tried/caught the RangeError, then you&#039;d see that the value of &lt;em&gt;someValue&lt;/em&gt; would still be what it was before.</description>
		<content:encoded><![CDATA[<p>Hey Carl,</p>
<p class="quoter_header">quote from <a href="http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null#comment-52268" title="go to original comment" class="quoted_comment_name">carl</a>:</p>
<blockquote cite="http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null#comment-52268"><p>
What DOES it return?</p>
</blockquote>
<p>Well it doesn&#8217;t really return anything, the getItemAt()-method is canceled and the error is thrown. If you would set the returned value to a variable called <em>&#8217;someValue&#8217;</em> and test the value after having tried/caught the RangeError, then you&#8217;d see that the value of <em>someValue</em> would still be what it was before.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carl</title>
		<link>http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null/comment-page-1#comment-52300</link>
		<dc:creator>carl</dc:creator>
		<pubDate>Thu, 28 Aug 2008 18:20:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null#comment-52300</guid>
		<description>This is possibly old news for you. However, there is a solution to this problem. Since it&#039;s not on here - figured I&#039;d at least post my findings. Use Try/Catch:

function myFunction():void{
try{
myArrayCollection.getItemAt(0);
trace(&#039;the item is there&#039;);
}
catch(e:RangeError){
 trace(&#039;the item is out of bounds&#039;); //or alert.show if you choose
}
}</description>
		<content:encoded><![CDATA[<p>This is possibly old news for you. However, there is a solution to this problem. Since it&#8217;s not on here &#8211; figured I&#8217;d at least post my findings. Use Try/Catch:</p>
<p>function myFunction():void{<br />
try{<br />
myArrayCollection.getItemAt(0);<br />
trace(&#8217;the item is there&#8217;);<br />
}<br />
catch(e:RangeError){<br />
 trace(&#8217;the item is out of bounds&#8217;); //or alert.show if you choose<br />
}<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carl</title>
		<link>http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null/comment-page-1#comment-52268</link>
		<dc:creator>carl</dc:creator>
		<pubDate>Thu, 28 Aug 2008 14:49:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null#comment-52268</guid>
		<description>Just a question as I&#039;m sort of running into the same problem. What DOES it return?</description>
		<content:encoded><![CDATA[<p>Just a question as I&#8217;m sort of running into the same problem. What DOES it return?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: berryblitz</title>
		<link>http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null/comment-page-1#comment-17696</link>
		<dc:creator>berryblitz</dc:creator>
		<pubDate>Sat, 02 Feb 2008 05:09:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null#comment-17696</guid>
		<description>We all know that Adobe Flex still have lots of errors that are quite weird that we don&#039;t get on other tools.  Maybe we give Flex some more time. Maybe on Adobe Flex 5 some of the &quot;weird&quot; issues would be solve.</description>
		<content:encoded><![CDATA[<p>We all know that Adobe Flex still have lots of errors that are quite weird that we don&#8217;t get on other tools.  Maybe we give Flex some more time. Maybe on Adobe Flex 5 some of the &#8220;weird&#8221; issues would be solve.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ruben</title>
		<link>http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null/comment-page-1#comment-9806</link>
		<dc:creator>Ruben</dc:creator>
		<pubDate>Thu, 08 Nov 2007 21:15:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null#comment-9806</guid>
		<description>..but you do get a RangeError, right?</description>
		<content:encoded><![CDATA[<p>..but you do get a RangeError, right?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null/comment-page-1#comment-9805</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Thu, 08 Nov 2007 20:57:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null#comment-9805</guid>
		<description>Actually, I have the same problem, if you try and test it against null it passes the test, and never returns null.

(myArrayCollection.getItemAt(invalidLocation) == null) never returns false.</description>
		<content:encoded><![CDATA[<p>Actually, I have the same problem, if you try and test it against null it passes the test, and never returns null.</p>
<p>(myArrayCollection.getItemAt(invalidLocation) == null) never returns false.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ruben</title>
		<link>http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null/comment-page-1#comment-8249</link>
		<dc:creator>Ruben</dc:creator>
		<pubDate>Fri, 26 Oct 2007 18:42:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null#comment-8249</guid>
		<description>Hmm, maybe, but it still sounds kinda shady to me ;)</description>
		<content:encoded><![CDATA[<p>Hmm, maybe, but it still sounds kinda shady to me <img src='http://www.rubenswieringa.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: boon</title>
		<link>http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null/comment-page-1#comment-8213</link>
		<dc:creator>boon</dc:creator>
		<pubDate>Fri, 26 Oct 2007 08:14:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubenswieringa.com/blog/arraycollectiongetitemat-doesnt-return-null#comment-8213</guid>
		<description>I think what the livedoc is trying to say is that if there is an object at that index, it will be returned, otherwise null is returned.  But if you try to access things outside of the valid range, of course you should get an exception.  It would be bad if the framework silently lets you do that without alarming you of your bug.</description>
		<content:encoded><![CDATA[<p>I think what the livedoc is trying to say is that if there is an object at that index, it will be returned, otherwise null is returned.  But if you try to access things outside of the valid range, of course you should get an exception.  It would be bad if the framework silently lets you do that without alarming you of your bug.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
