<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>A Twofer &#187; ErrorEvent.errorID</title>
	<atom:link href="http://www.atwofer.com/category/erroreventerrorid/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.atwofer.com</link>
	<description>A place to talk about Software Development (RoR, J2EE, J2ME, CSS, HTML, JavaScript, Objective-C, etc) and some other stuff</description>
	<lastBuildDate>Fri, 16 Jul 2010 14:56:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Getting the errorID from an ErrorEvent in ActionScript</title>
		<link>http://www.atwofer.com/2009/02/24/getting-the-errorid-from-an-errorevent-in-actionscript/</link>
		<comments>http://www.atwofer.com/2009/02/24/getting-the-errorid-from-an-errorevent-in-actionscript/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 04:15:29 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[ErrorEvent]]></category>
		<category><![CDATA[ErrorEvent.errorID]]></category>
		<category><![CDATA[FlashPlayer]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.atwofer.com/?p=85</guid>
		<description><![CDATA[Our Episodic Video Player is written in ActionScript 3.  I&#8217;m still fairly new to ActionScript but came up with a solution to a problem the other day that I thought I should share.
The player loads various files from the server.  In some cases I want to display an error when one of those [...]]]></description>
			<content:encoded><![CDATA[<p>Our <a href="http://www.episodic.com/" target="_blank">Episodic Video Player</a> is written in ActionScript 3.  I&#8217;m still fairly new to ActionScript but came up with a solution to a problem the other day that I thought I should share.</p>
<p>The player loads various files from the server.  In some cases I want to display an error when one of those files can&#8217;t be found.  I have an error handler that listens for <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/ErrorEvent.html" target="_blank">Error Events</a> and displays an appropriate error message depending on the type of the error event.  For example, I know that error code 2032 will generally mean in our case that the file could not be found. </p>
<p>Alright, so this all seems simple enough except for one problem.  When I looked at the <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/ErrorEvent.html#errorID" target="_blank">ASDocs for ErrorEvent.errorID</a> I noticed that that property is not available for Flash Player 9.  Fortunately, ErrorEvent extends <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/TextEvent.html" target="_blank">TextEvent</a> which has text property I can access.  In the case of an ErrorEvent the text property contains a message that includes the error ID.  Therefore, I just wrote my own getter to grab the error ID.</p>
<p><code>public function get errorID():int {<br />
<span style="padding-left: 10px;">if ((text != null) &#038;&#038; (text.indexOf("Error #") == 0) </span><br />
<span style="padding-left: 40px;">&#038;&#038; (text.length > 7)) {</span><br />
<span style="padding-left: 20px;">// The Error IDs always seem to be 4 digits</span><br />
<span style="padding-left: 20px;">return parseInt(errorEvent.text.substr(7, errorEvent.text.length - 7));</span><br />
}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.atwofer.com/2009/02/24/getting-the-errorid-from-an-errorevent-in-actionscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
