<?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>Flassari.is &#187; uncaughtError</title>
	<atom:link href="http://flassari.is/tag/uncaughterror/feed/" rel="self" type="application/rss+xml" />
	<link>http://flassari.is</link>
	<description></description>
	<lastBuildDate>Sat, 28 Jan 2012 08:17:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Global error handling with Flash Player 10.1</title>
		<link>http://flassari.is/2010/06/global-error-handling-with-flash-player-10-1/</link>
		<comments>http://flassari.is/2010/06/global-error-handling-with-flash-player-10-1/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 12:25:44 +0000</pubDate>
		<dc:creator>Flassari</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[10.1]]></category>
		<category><![CDATA[4.1]]></category>
		<category><![CDATA[as]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[exception]]></category>
		<category><![CDATA[global]]></category>
		<category><![CDATA[handler]]></category>
		<category><![CDATA[handling]]></category>
		<category><![CDATA[player]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[uncaught]]></category>
		<category><![CDATA[uncaughtError]]></category>
		<category><![CDATA[uncaughterrorhandler]]></category>

		<guid isPermaLink="false">http://flassari.is/?p=303</guid>
		<description><![CDATA[Since the official release of Flash Player 10.1 is out, now might be a good time to start implementing the global error handler.

When this is written, flash builder 4 doesn't have a native way that lets you use it, so we have to do a little mix.
The global error handler works by adding an event to the uncaughtErrorEvents property of the loaderInfo of the application.
There are currently two methods of getting it to work [...] ]]></description>
			<content:encoded><![CDATA[<p>Since the official release of Flash Player 10.1 is out, now might be a good time to start implementing the global error handler.</p>
<p>When this is written, flash builder 4 doesn&#8217;t have a native way that lets you use it, so we have to do a little mix.<strong> (Update: The update is out.)</strong><br />
The global error handler works by adding an event to the uncaughtErrorEvents property of the loaderInfo of the application.<br />
There are currently two methods of getting it to work.</p>
<h3>Method 1 - The backwards compatible one:</h3>
<p>Here the code doesn&#8217;t crash in flash player 9/10, but the error handling will only work in 10.1.</p>
<pre class="brush: as3">if(loaderInfo.hasOwnProperty("uncaughtErrorEvents")){
	IEventDispatcher(loaderInfo["uncaughtErrorEvents"]) .addEventListener("uncaughtError", uncaughtErrorHandler);
}</pre>
<pre class="brush: as3">private function uncaughtErrorHandler(e:Event):void {
	trace("Global error:", e);
}</pre>
<h3>Method 2 - The type safe one:</h3>
<p>Get the <a href="http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4">Flex 4.1 SDK</a> if you haven&#8217;t already and choose that one as your project&#8217;s SDK.</p>
<p>Now you can use the new global error handling like it was meant to be used:</p>
<pre class="brush: as3">import flash.events.UncaughtErrorEvent;

loaderInfo.uncaughtErrorEvents.addEventListener( UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorHandler);

private function uncaughtErrorHandler( e:UncaughtErrorEvent):void {
	trace("Global error:", e);
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://flassari.is/2010/06/global-error-handling-with-flash-player-10-1/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

