<?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>Thinking in Code</title>
	<atom:link href="http://www.michelboudreau.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.michelboudreau.com</link>
	<description>Michel Boudreau&#039;s Personal Blog</description>
	<lastBuildDate>Sun, 05 Sep 2010 05:00:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>I&#8217;m Speaking at Adobe MAX</title>
		<link>http://www.michelboudreau.com/2010/09/04/im-speaking-at-adobe-max/</link>
		<comments>http://www.michelboudreau.com/2010/09/04/im-speaking-at-adobe-max/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 15:41:51 +0000</pubDate>
		<dc:creator>Michel Boudreau</dc:creator>
				<category><![CDATA[Adobe Max]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[FITC]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[Delivery integration]]></category>
		<category><![CDATA[integration engine]]></category>
		<category><![CDATA[lab49]]></category>

		<guid isPermaLink="false">http://www.michelboudreau.com/?p=420</guid>
		<description><![CDATA[Well, not exactly Adobe MAX, I&#8217;ll be speaking at FITC Unconference @ Adobe MAX which is your normal FITC sessions that are a lot more technically inclined.  I&#8217;ll be talking about Agile Project and Delivery Integration;  Don&#8217;t miss this session if you work on large enterprise applications. Hope to see some familiar faces there.]]></description>
			<content:encoded><![CDATA[<p>Well, not exactly <a href="http://max.adobe.com/" target="_blank">Adobe MAX</a>, I&#8217;ll be speaking at <a href="http://www.fitc.ca/events/about/?event=117" target="_blank">FITC Unconference @ Adobe MAX</a> which is your normal FITC sessions that are a lot more technically inclined.  I&#8217;ll be talking about <a href="http://www.fitc.ca/events/presentations/presentation.cfm?event=117&amp;presentation_id=1384" target="_blank">Agile Project and Delivery Integration</a>;  Don&#8217;t miss this session if you work on large enterprise applications.</p>
<p>Hope to see some familiar faces there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michelboudreau.com/2010/09/04/im-speaking-at-adobe-max/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Phone 7 Impressions</title>
		<link>http://www.michelboudreau.com/2010/08/30/windows-phone-7-impressions/</link>
		<comments>http://www.michelboudreau.com/2010/08/30/windows-phone-7-impressions/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 22:56:03 +0000</pubDate>
		<dc:creator>Michel Boudreau</dc:creator>
				<category><![CDATA[Flash Platform]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[lab49]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[smartphone]]></category>
		<category><![CDATA[windows phone]]></category>
		<category><![CDATA[xbox live]]></category>

		<guid isPermaLink="false">http://www.michelboudreau.com/?p=406</guid>
		<description><![CDATA[Last night, I went to a Windows Phone 7 Developer event aptly name &#8216;Developer Happy Hour&#8217; which was organized by the Flash New York Meetup.  We met at a bar where some Microsoft evangelists showed up with a few phones that we could play with.  Here are some of the impressions I got from talking [...]]]></description>
			<content:encoded><![CDATA[<p>Last night, I went to a Windows Phone 7 Developer event aptly name &#8216;Developer Happy Hour&#8217; which was organized by the <a href="http://www.meetup.com/nyflash/" target="_blank">Flash New York Meetup</a>.  We met at a bar where some Microsoft evangelists showed up with a few phones that we could play with.  Here are some of the impressions I got from talking to the employees and playing around with the phone.</p>
<p><span id="more-406"></span>First off, the phone that was used as a prototype was an <a href="http://www.engadget.com/2010/08/20/exclusive-lg-c900-for-atandt-has-windows-phone-7-shows-off-a-lit/" target="_blank">LG C900</a> which felt cheap and plasticky. However, the screen was remarkably responsive; I don&#8217;t know if it&#8217;s the phone or the software, but it made for a very agreeable experience.</p>
<p>When moving from menu to application or sub-menu, there were nifty little animations that made the transition very smooth and enjoyable. The UI is well thought out and made it easy to get to the content that you want. My only problem is that because it&#8217;s a landscape UI, it might take a while to get where you need since you&#8217;ll need to swipe several times to get there.  It&#8217;s slightly counter-productive, but how you get there is nice.</p>
<p>My colleague, <a href="http://northhorizon.net" target="_blank">Daniel Moore</a>, asked the evangelist at the meet how they were going to deploy the updates to the phone.  This is something that most people find frustrating with most phones since it&#8217;s normally the carrier that decides when they push out the update which can take months after the initial release.  In this case though, the carrier has no involvement.  Microsoft will make the update available online as soon as it is release; the users can then download and install on their own free will.  This is great news because I don&#8217;t think Microsoft is going to stop developing this platform any time soon.</p>
<p>Of course, I had to inquire the evangelist about Flash/Air for WP7.  His answer was short and sweet: &#8220;We&#8217;ll put it in as soon as Adobe makes it available&#8221;.  You hear that Adobe?  Get to it!  Porting Flash/Flex apps to Android and WP7 is a beautiful thing.  Microsoft is not closing any walls on this platform, they believe that choice will always make for a better product;  I couldn&#8217;t agree more.</p>
<p>Another thing that impressed me was the Xbox live integration.  You get your profile loaded on your phone automatically and you can play some fairly impressive 3D rendered games or just some fun 2D arcade games.  Right now the library of games is fairly limited to in-house made demos but still, those demos were pretty darn good for harnessing the power of the hardware.</p>
<p>The one thing that I really didn&#8217;t like is something that in my opinion has been plaguing Microsoft for ages: Internet Explorer.  I believe that Microsoft should take a page from the marketing book and just create a new brand.  There&#8217;s a reason why large companies create sub-companies with a different name, because they want their brand to be renown for something in particular.  When you hear &#8216;Hoover&#8217; you think vacuum, when you hear &#8216;Kleenex&#8217; you think facial tissue;  right now, when I hear &#8216;Internet Explorer&#8217;, I think security issue.  This is something that needs to change for people to be more confident around it.  You&#8217;ll find most browsers have shorter names that are easy to remember (Firefox, Safari, Opera, Chrome, etc) and it doesn&#8217;t need to include &#8216;internet&#8217; in it (stop patronizing us).  I know the brand&#8217;s been around forever, but this isn&#8217;t the 90&#8242;s anymore.  You&#8217;ll also find that most browsers have a different brand just for the mobile version of it (Firefox is Fennec, Safari Mobile, etc).  I believe this is a necessary step in the evolution of Internet Explorer.  I personally would never use it for my own purposes because of its tight integration with the file system which I think is a security risk, but still, a new brand could definitely sway people who aren&#8217;t tech oriented as long as they do a good job of it.</p>
<p>Overall, I&#8217;m rather pleased with the software, it was still a little buggy at times but nothing blatant which is normal for something that hasn&#8217;t been released yet.  The hardware itself felt cheap, however I can imagine the experience being better once a good mobile hardware company (like HTC) gets their device out.  I can pretty much guarantee that any Microsoft enthusiast is going to be thrilled with this device.  Being an Android fan myself, I think this brings a new edge to the market where competition is always welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michelboudreau.com/2010/08/30/windows-phone-7-impressions/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Flex/Actionscript UML Tool: UML4AS</title>
		<link>http://www.michelboudreau.com/2010/08/18/flexactionscript-uml-tool-uml4as/</link>
		<comments>http://www.michelboudreau.com/2010/08/18/flexactionscript-uml-tool-uml4as/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 19:08:39 +0000</pubDate>
		<dc:creator>Michel Boudreau</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flash Platform]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[as]]></category>
		<category><![CDATA[CodeSync]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[lab49]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[uml]]></category>
		<category><![CDATA[uml4as]]></category>

		<guid isPermaLink="false">http://www.michelboudreau.com/?p=389</guid>
		<description><![CDATA[Anyone remember Saffron?  I was never certain if this project was ever going to come to fruition, so lately I was thinking excessively about making my own.  I started searching for inspiration in other UML tools so I could design a better user interface.  Low and behold, I stumble across UML4AS, a brand spanking new [...]]]></description>
			<content:encoded><![CDATA[<p>Anyone remember <a href="http://www.michelboudreau.com/2010/04/30/saffron-is-still-alive/" target="_blank">Saffron</a>?  I was never certain if this project was ever going to come to fruition, so lately I was thinking excessively about making my own.  I started searching for inspiration in other UML tools so I could design a better user interface.  Low and behold, I stumble across <a href="http://www.uml4as.com" target="_blank">UML4AS</a>, a brand spanking new project that does just what I was planning of doing.</p>
<p>It integrates completely with Eclipse (and Flash Builder) and has this neat feature called CodeSync that makes sure your model and code is always persisted between each other.  In other words, everything works together in an integrated workflow to save you time.</p>
<p>I&#8217;ll have to dig deeper, try this out on projects and do a complete review.  In the meantime, please support this initiative by registering and posting on the forum.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michelboudreau.com/2010/08/18/flexactionscript-uml-tool-uml4as/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex on Android</title>
		<link>http://www.michelboudreau.com/2010/08/15/flex-on-android/</link>
		<comments>http://www.michelboudreau.com/2010/08/15/flex-on-android/#comments</comments>
		<pubDate>Sun, 15 Aug 2010 22:53:27 +0000</pubDate>
		<dc:creator>Michel Boudreau</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Flash Platform]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[air for android]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[lab49]]></category>
		<category><![CDATA[settings]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.michelboudreau.com/?p=367</guid>
		<description><![CDATA[Last Flex Meetup I had a presentation on how to develop a Flex application and run it on the Android mobile OS using Air for Android.  I&#8217;m now going to go step by step on how to do it.  Information on how to accomplish this feat is fairly scarce, especially example projects, and hopefully this [...]]]></description>
			<content:encoded><![CDATA[<p>Last <a href="http://www.meetup.com/New-York-Flex-Meetup/" target="_blank">Flex Meetup</a> I had a presentation on how to develop a Flex application and run it on the <a href="http://www.android.com/">Android mobile OS</a> using <a href="http://labs.adobe.com/technologies/air2/android/" target="_blank">Air for Android</a>.  I&#8217;m now going to go step by step on how to do it.  Information on how to accomplish this feat is fairly scarce, especially example projects, and hopefully this will help pave the way.</p>
<p>First things first, everyone that wants to develop Air for Android needs to sign-up to the<a href="http://www.adobe.com/go/airbetasignup" target="_blank"> pre-release program @ Adobe</a>.  This is a central location to get all the latest files (like the Air 2.5 SDK) and documentation on this platform.  It&#8217;s also a good way to communicate with other developers, see projects that people are doing and post any questions or feedback about your development with Air.</p>
<h2><span id="more-367"></span>Setup</h2>
<p>Say you have Flash Builder already installed (duh?!), you need to download the <a href="http://developer.android.com/sdk/index.html" target="_blank">Android SDK</a> and then download the Android plugin for Eclipse (Flash Builder).  SDK first, just go to the link and download (and extract) the SDK that fits your flavor of OS.  Then just run the setup which should update the SDK to the latest and greatest.</p>
<p>Next you need to install the plugin.  Go into Flash Builder and go under Help-&gt;Install New Software&#8230; and then type in &#8220;https://dl-ssl.google.com/android/eclipse/&#8221; for the location and click on &#8216;Add&#8217;.  You should see the plugin available; just choose it and install.  After you restart, you should see this icon:</p>
<p style="text-align: center;"><a href="http://www.michelboudreau.com/wp-content/uploads/2010/08/avd.png"><img class="aligncenter size-full wp-image-370" title="AVD Manager" src="http://www.michelboudreau.com/wp-content/uploads/2010/08/avd.png" alt="" width="444" height="149" /></a><em>Green dude in a box, that definitely means the Android Virtual Device Manager</em></p>
<p style="text-align: left;">That icon is there for you to create emulators.  Yes, that&#8217;s right, you can run Android on your computer and install apps on it.  However, one fairly major caveat is that it&#8217;s fairly slow.  It&#8217;s good for a quick sanity check and QA, but any major debugging/quality procedure should be done on a physical device.</p>
<p style="text-align: left;">After you&#8217;ve created your emulator, make sure you get the latest <a href="http://opensource.adobe.com/wiki/display/flexsdk/download?build=4.1.0.16076&amp;pkgtype=1">Flex SDK </a>(4.1) and extract the AIR SDK 2.5 right over the Flex SDK directory.  You are now ready to start coding; just make sure your project is pointing to the proper Flex SDK directory.</p>
<h2 style="text-align: left;">Code</h2>
<p style="text-align: left;">From here you can take an old project and make it for mobile, create a new project or better yet, use my<a href="http://www.michelboudreau.com/wp-content/uploads/2010/08/HelloWorld-FlexOnAndroid.zip"> pre-made example project</a> that I made for this tutorial.  This project is very simple, but the project is not what I want to concentrate on.  I want to focus our attention on how to make it all compile and deploy on Android.  This is what my application looks like:</p>
<p style="text-align: center;"><a href="http://www.michelboudreau.com/wp-content/uploads/2010/08/HelloWorld1.png"><img class="aligncenter size-full wp-image-373" title="Hello World Screenshot 1" src="http://www.michelboudreau.com/wp-content/uploads/2010/08/HelloWorld1.png" alt="" width="600" height="425" /></a><em>Yeah, Android likes to be touched&#8230;</em></p>
<p style="text-align: center;"><em><a href="http://www.michelboudreau.com/wp-content/uploads/2010/08/HelloWorld2.png"><img class="aligncenter size-full wp-image-374" title="Hello World Screenshot 2" src="http://www.michelboudreau.com/wp-content/uploads/2010/08/HelloWorld2.png" alt="" width="600" height="425" /></a>But not there.  Sicko.<br />
</em></p>
<p style="text-align: left;">Now, when you first start your project, you just need to set it as an AIR project and make sure your SDK directory points to the right location.  After that there are a few changes that need to be done or else it won&#8217;t package into an APK (the native Android application package) properly.</p>
<p style="text-align: left;">First, we need to make a small change to the code.  In your main application file, we need to change the WindowedApplication tag to just Application.  That&#8217;s all you need to do code-wise.  If you adhere to good Flex standards, you should have a main component that holds all your application logic; it&#8217;s easier this way to just drop the component into any container for easy interchange between Desktop or Web project.  Using this technique is crucial to keep code re-used high, while keeping project settings different from one another.</p>
<p style="text-align: left;">On to the settings of the application.  Open up the xml file that was generated by Flash Builder (should be in the form of &#8216;YourProject-app.xml&#8217;) .  There are a few things that needs to change, and a few things that need to be added that are Android specific depending on what your application wants to have access to (permissions).  Here&#8217;s the xml settings for my application:</p>
<p style="text-align: left;">
<pre class="brush: xml;">
xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; standalone=&quot;no&quot;?&gt;
xmlns=&quot;http://ns.adobe.com/air/application/2.5&quot;&gt;
	&lt;!-- The application identifier string, unique to this application. Required. --&gt;
	&lt;id&gt;HelloWorld&lt;/id&gt;

	&lt;!-- Used as the filename for the application. Required. --&gt;
	&lt;filename&gt;HelloWorld&lt;/filename&gt;
	&lt;name&gt;HelloWorld&lt;/name&gt;

	&lt;!-- The name that is displayed in the AIR application installer.
	     May have multiple values for each language. See samples or xsd schema file. Optional. --&gt;

	&lt;!-- An application version designator (such as &quot;&lt;span class=&quot;hiddenSpellError&quot; pre=&quot;as &quot;&gt;v1&lt;/span&gt;&quot;, &quot;2.5&quot;, or &quot;Alpha 1&quot;). Required. --&gt;
	&lt;versionNumber&gt;1.0&lt;/versionNumber&gt;

	&lt;supportedProfiles&gt;mobileDevice&lt;/supportedProfiles&gt;
	&lt;initialWindow&gt;
		&lt;content&gt;HelloWorld.swf&lt;/content&gt;
		&lt;visible&gt;true&lt;/visible&gt;
		&lt;autoOrients&gt;true
	&lt;/initialWindow&gt;
&lt;/application&gt;
</pre>
<p>A few things are going on here.  You&#8217;ll notice that the namespace for the document changed from &#8220;http://ns.adobe.com/air/application/2.0&#8243; to &#8220;http://ns.adobe.com/air/application/2.5&#8243;.  This is needed to target the new Air SDK.  There has also been some schema updates.  In 2.0 we had the &#8220;version&#8221; tag, but it&#8217;s now replaced with the &#8220;versionNumber&#8221;.  Another important part is the &#8220;supportedProfiles&#8221; tag which is needed to specify what type of device you&#8217;re aiming for and also helps for when you&#8217;re testing the application because the Flash Player window resizes to mobile resolution.  And to finish, you need to set up the &#8216;window&#8217;. The &#8216;visible&#8217; tag is important or else you have to make the application visible through code and the &#8216;autoOrients&#8217; is a flag to let your application know if it&#8217;s in landscape or portrait.  More information about extra tags are all in the documentation PDF on the pre-release page.<strong> </strong> One section that&#8217;s very important to read is the &#8216;Permissions&#8217; section which is needed in the xml config.  Android needs this information to know how to give certain access to the application, like the camera or internet.</p>
<h2>Build</h2>
<p>You&#8217;ll notice that there&#8217;s a &#8216;build&#8217; folder in the <a href="http://www.michelboudreau.com/wp-content/uploads/2010/08/HelloWorld-FlexOnAndroid.zip">example project</a>, that contains an Ant script.  I made this so that I can easily compile and install the debug and release version of my application.  Only need to change the property file to point to the Android and Flex SDK then execute the &#8216;run_debug&#8217; or &#8216;run_release&#8217; target and it&#8217;ll do the rest for you.</p>
<h2>Debug</h2>
<p>Of course, after you&#8217;ve tested it locally on your own computer, a lot of people would like to debug their application on the actual device (emulator debugging isn&#8217;t available currently).  You can do this directly from Flash Builder using Remote Debugging.  For this to happen, you need to make sure that the phone and computer are on the same network (make sure your phone&#8217;s wi-fi is on and connected).  The phone then needs to have access to the internet.  You may have noticed that I create 2 tags in the main application config file, &#8216;debug&#8217; and &#8216;release&#8217;.</p>
<pre class="brush: xml;">
&lt;!-- DEBUG SPECIFIC CONFIGURATION --&gt;
&lt;debug&gt;
	&lt;android&gt;
		&lt;manifestAdditions&gt;
			&lt;manifest&gt;
				&lt;data&gt;
					&lt;!--[&lt;span class=&quot;hiddenSpellError&quot; pre=&quot;&quot;&gt;CDATA&lt;/span&gt;[--&gt;
						&lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;
					]]&gt;
				&lt;/data&gt;
			&lt;/manifest&gt;
		&lt;/manifestAdditions&gt;
	&lt;/android&gt;
&lt;/debug&gt;

&lt;!-- RELEASE SPECIFIC CONFIGURATION --&gt;
&lt;release&gt;

&lt;/release&gt;
</pre>
<p>These tags get commented out when compiled.  This is where I added my internet permission request for Android.  Lastly, you need to make sure that you specify the IP of your computer within the build properties so that the swf knows where the debugger is.  Everything else is handled by the build script.</p>
<p>Then you just need to create a new debug profile under &#8216;Web Application&#8217; and set URL to &#8216;about:blank&#8217;.  Set the project to the Air project that you want to debug.  An error will show saying that the &#8220;Project must be an Actionscript or Flex project&#8221;; you can just ignore that.</p>
<p><a href="http://www.michelboudreau.com/wp-content/uploads/2010/08/AndroidDebug.png"><img class="aligncenter size-full wp-image-380" title="AndroidDebug" src="http://www.michelboudreau.com/wp-content/uploads/2010/08/AndroidDebug.png" alt="" width="600" height="480" /></a></p>
<p>After that, it&#8217;s as simple as running the debug and opening the application on your phone.  When the application starts, it&#8217;ll try to connect to Flash Builder and start-up the remote debugging session.</p>
<h2>Conclusion</h2>
<p>I have to say, I was impressed with how simple the whole process is after you get to know how things work.  Being the efficiency Nazi that I am, having the Ant script build and deploy the whole project helps the whole process become a lot more streamlined.  Playing around with Air, I haven&#8217;t seen any weird behavior from the transition to mobile; you just need to make sure that your code is fast and appropriate for the screen size.  I was thoroughly impressed with the whole process.  It&#8217;s incredibly easy to make an application for Android and I hope that it will stay just as easy for other mobile OS&#8217; in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michelboudreau.com/2010/08/15/flex-on-android/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>FirebugLoggerTarget Class</title>
		<link>http://www.michelboudreau.com/2010/07/13/firebugloggertarget-class/</link>
		<comments>http://www.michelboudreau.com/2010/07/13/firebugloggertarget-class/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 04:29:07 +0000</pubDate>
		<dc:creator>Michel Boudreau</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[firebuglogger]]></category>
		<category><![CDATA[firebugloggertarget]]></category>
		<category><![CDATA[lab49]]></category>
		<category><![CDATA[tracetarget]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://www.michelboudreau.com/?p=358</guid>
		<description><![CDATA[Some of you might of seen my past post about the FirebugLogger class.  It was an easy way to have text show up in the Firebug console in Firefox and has proven itself quite useful.  However, since I&#8217;ve been using Parsley a lot lately I needed something new to show the output of Parsley in [...]]]></description>
			<content:encoded><![CDATA[<p>Some of you might of seen my past post about the <a href="http://www.michelboudreau.com/2009/04/29/firebuglogger-class/">FirebugLogger class</a>.  It was an easy way to have text show up in the Firebug console in Firefox and has proven itself quite useful.  However, since I&#8217;ve been using Parsley a lot lately I needed something new to show the output of Parsley in Firebug.  Parlsey uses the native Flex logging framework (like TraceTarget) when you specify it in the config.</p>
<p><span id="more-358"></span>What I&#8217;ve done is extend TraceTarget and include some code so that any output goes to Firebug.  Simple enough, but very useful when you don&#8217;t have to have your debugger always running to see the output.</p>
<pre class="brush: as3;">
package com.codemonkeycreative.utils
{
	import flash.external.ExternalInterface;

	import mx.formatters.DateFormatter;
	import mx.logging.ILogger;
	import mx.logging.LogEvent;
	import mx.logging.LogEventLevel;
	import mx.logging.targets.TraceTarget;

	public class FirebugLoggerTarget extends TraceTarget
	{
		private var _dateFormatter:DateFormatter = new DateFormatter();

		public function FirebugLoggerTarget()
		{
			super();
		}

		/**
		 * Overrides the main function of TraceTarget that gets triggered
		 * every time someone tries to log anything using a Logger
		 **/
		override public function logEvent(event:LogEvent):void
		{
			// send the event to be traced normally
			super.logEvent(event);
			// Find the level
			var levelType:String = getLevelString(event.level);
			var level:String = includeLevel?levelType.toUpperCase():'';

			// Date variables
			var date:String = &quot;&quot;;
			var d:Date = new Date();

			// Format date
			if(includeDate)
			{
				this._dateFormatter.formatString = &quot;MM/DD/YYYY&quot;;
				date = this._dateFormatter.format(d) + fieldSeparator;
			}

			// Format time
			if(includeTime)
			{
				this._dateFormatter.formatString = &quot;J:N:SS.QQQ&quot;;
				date += '[' + this._dateFormatter.format(d) + ']' + fieldSeparator;
			}

			// Find the category
			var category:String = includeCategory ? ILogger(event.target).category + fieldSeparator : &quot;&quot;;

            // Then output it in firebug
            if(ExternalInterface.available)
            {
				ExternalInterface.call(&quot;console.&quot;+levelType, date + level + category + event.message);
            }
		}

		/**
		 * Returns the string equivalend of the level enum.
		 * This is needed for firebug to understand the console output.
		 **/
		private function getLevelString(level:int):String
		{
     		switch(level)
			{
				case LogEventLevel.DEBUG:
					return 'debug';
					break;
				case LogEventLevel.INFO:
					return 'info';
					break;
				case LogEventLevel.WARN:
					return 'warn';
					break;
				case LogEventLevel.FATAL:
				case LogEventLevel.ERROR:
					return 'error';
					break;
				case LogEventLevel.ALL:
				default:
					return 'log';
					break;
			}
		}
	}
}
</pre>
<p>Simply create this class and include it in your project.  Then in your config file, just add the following line.</p>
<pre class="brush: xml;">
&lt;utils:FirebugLoggerTarget level=&quot;{LogEventLevel.ALL}&quot; includeTime=&quot;true&quot; includeDate=&quot;true&quot; /&gt;
</pre>
<p>You just need to change the properties like you normally on TraceTarget and the class does the rest.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michelboudreau.com/2010/07/13/firebugloggertarget-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
