<?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>debugwindow &#8211; Software, Fitness, and Gaming &#8211; Jesse Warden</title>
	<atom:link href="https://jessewarden.com/tag/debugwindow/feed" rel="self" type="application/rss+xml" />
	<link>https://jessewarden.com</link>
	<description>Software &#124; Fitness &#124; Gaming</description>
	<lastBuildDate>Thu, 18 Feb 2010 15:59:33 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://jessewarden.com/wp-content/uploads/2016/08/cropped-Lambda2-32x32.png</url>
	<title>debugwindow &#8211; Software, Fitness, and Gaming &#8211; Jesse Warden</title>
	<link>https://jessewarden.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Debug Window v2 &#8211; Simple Flex Debug Window</title>
		<link>https://jessewarden.com/2010/02/debug-window-v2-simple-flex-debug-window.html</link>
					<comments>https://jessewarden.com/2010/02/debug-window-v2-simple-flex-debug-window.html#comments</comments>
		
		<dc:creator><![CDATA[JesterXL]]></dc:creator>
		<pubDate>Thu, 18 Feb 2010 15:46:53 +0000</pubDate>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[debugwindow]]></category>
		<category><![CDATA[logging]]></category>
		<guid isPermaLink="false">http://jessewarden.com/?p=1988</guid>

					<description><![CDATA[Back in Flex 1.5, I created a simple DebugWindow that was 1 class, and worked inside of Flex apps. Â I don&#8217;t like a lot of complexity, and the fact I just needed to drop 1 class in my project, and write 2 lines of code to make it work was something that no others delivered [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a href="http://jessewarden.com/wp-content/uploads/2010/02/debugwindowv2.png"><img decoding="async" style="padding-right: 4px; padding-bottom: 4px;" title="debugwindowv2" src="http://jessewarden.com/wp-content/uploads/2010/02/debugwindowv2-300x222.png" alt="" width="180" height="133" align="left" /></a>Back in Flex 1.5, I created a simple <a href="http://www.jessewarden.com/archives/flex/flash_flex/source/srcview/">DebugWindow</a> that was 1 class, and worked inside of Flex apps. Â I don&#8217;t like a lot of complexity, and the fact I just needed to drop 1 class in my project, and write 2 lines of code to make it work was something that no others delivered on. Â Using trace required you to not look at your Flex app to see traces, you had to run in debug mode, and you had to use ASCII art to filter messages. Â IÂ was using <a href="http://www.luminicbox.com/blog/">LuminicBox</a> for Flex 1.5 projects later in the game, and in 2 &amp; 3, I used the <a href="http://yourpalmark.com/2007/02/19/luminicboxlog-as3-update/">AS3 update of it by Mark Walters</a>. Â There were a couple of problems, though, and some features I wanted to add.</p>
<p><span id="more-1988"></span>So, I revisited my DebugWindow in hopes of keeping the same setup &amp; ease of use simplicity. Â DebugWindow only required 1 class, and 2 lines of code to make it work. Â However, I wanted the message type &amp; filtering that LuminicBox had with 2 other features: developer message filtering &amp; clipboard copy.</p>
<p>Enter DebugWindow v2. Â There are plenty of other debuggers out there, so here&#8217;s the quick skizzy on what mine offers.</p>
<p><strong>Features</strong></p>
<ol>
<li>If you are/were a LuminicBox fan, you&#8217;ll (mostly) feel at home.</li>
<li>Works in your application; no browser or AIR dependencies</li>
<li>Simple setup; requires a SWC and 2 lines of code.</li>
<li>Open source under MIT license.</li>
<li>Simple API; Debug.log, Debug.debug, etc.</li>
<li>Works; I&#8217;ve used on 4 projects so far.</li>
<li>Works in Flex 3 &amp; 4.</li>
<li>Works in AIR.</li>
<li>Trivial to wire up to work in AS3 AIR.</li>
<li>Falls back to trace.</li>
<li>Filters message types by log, debug, info, warn, error, and fatal.</li>
<li>Easily copy to clipboard.</li>
<li>Auto-scrolling can be turned off.</li>
<li>Easy to clear.</li>
<li>Filter message types.</li>
<li>Compile time filtering for different loggers; for example, you can choose to only show your messages and a profiler for example.</li>
<li>Built using Flex SDK; tweak if you need to.</li>
<li>You can close it and your messages are still there and continually recorded.</li>
</ol>
<p><strong>Cons</strong></p>
<ul>
<li>Doesn&#8217;t work in the Flash IDE.</li>
<li>Not very fast (remove from production code).</li>
</ul>
<p><strong>How to Use</strong></p>
<p>Drop the SWC into your libs folder. Â Then, use this code (I typically do it in Application.mxml file&#8217;s script block).</p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;"><span class="keyword">import</span> <span class="identifier2">mx</span>.<span class="identifier2">managers</span>.<span class="identifier2">PopUpManager</span>;</span></p>
<p><code> </code></p>
<p><code></p>
<pre><span class="identifier2">PopUpManager</span>.<span class="identifier2">createPopUp</span>(<span class="identifier">this</span>, DebugMax, <span class="identifier">false</span>);
DebugMax.<span class="identifier">log</span>(<span class="string">"Application::init, DebugMax ready and able, SIR!"</span>);</pre>
<p></code></p>
<p><strong>Message Types</strong></p>
<p>For more thorough documentation on when/where to utilize the different message types, refer to<a href="http://jessewarden.com/2010/02/consulting-chronicles-3-preventing-fire-drills-crises-by-removing-land-mines-and-using-diagnostic-tools.html#writinglogmessages"> the logging section</a> in my previous consulting article. Â Below, I&#8217;ll briefly cover them.</p>
<p>Log&#8217;s are for common messages that should occur every time your application runs. Â If you don&#8217;t see these log messages, you should be worried.</p>
<p>Debug&#8217;s are for when writing new code that you want to visually confirm is working in addition to your unit tests. Â  They are also for log messages you don&#8217;t intend to leave in your application long; they are supposed to stand out as being temporary.</p>
<p>Info&#8217;s are for unique situations you want be made aware of, but aren&#8217;t necessarily bad. Â They are best used in tandem with debug&#8217;s so they stand out.</p>
<p>Warn&#8217;s are for errors that occur, but don&#8217;t negatively affect application functionality, such as images not loading, fullscreen not working because you forgot the correct JavaScript, etc.</p>
<p>Error&#8217;s are for logging all errors; synchronous, asynchronous, and custom ones. Â Not all try/catch blocks should have them (some can be regulated to warns), but anything bad should be put here.</p>
<p>Fatal&#8217;s aren&#8217;t really ever used since there aren&#8217;t a lot of fatal things in Flash Player. Â Usually these are business specific such as an initial XML configuration file that your application requires to run not loading, running out of memory, or other crucial things not happening like they should.</p>
<p><strong>Additional Notes</strong></p>
<p>The Debug window save&#8217;s its current position in a local SharedObject. Â If you&#8217;re app shrinks and the window appears off-screen, just delete your SO, or just call a win.move(0, 0) or PopUpManager.centerPopUp(win) on it to reset it.</p>
<p>The Message ValueObject has the ability to add a time stamp for each message, but it&#8217;s commented out. Â If you wish to have those for validation, open up the Message.as class, and you&#8217;ll see the line of code to uncomment.</p>
<p>Finally, using in AIR requires a simple wrapper window. Â Here&#8217;s some code to get you started:</p>
<p><code></p>
<pre><span class="keyword">private</span> <span class="keyword">var</span> debugWin:<span class="identifier2">Window</span>;

<span class="keyword">private</span> <span class="keyword">function</span> onOpenDebugWindow(<span class="identifier2">event</span>:Event):<span class="keyword">void</span>
{
        openDebugWindow();
}

<span class="keyword">private</span> <span class="keyword">function</span> openDebugWindow():<span class="keyword">void</span>
{
        <span class="keyword">if</span>(debugWin == <span class="identifier">null</span>)
        {
                debugWin = <span class="keyword">new</span> <span class="identifier2">Window</span>();
                debugWin.<span class="identifier2">addEventListener</span>(Event.CLOSE, onDebugClosed);
                debugWin.addChild(<span class="keyword">new</span> Debug());
                debugWin.<span class="identifier2">open</span>();
                debugWin.<span class="identifier2">width</span> = 556;
                debugWin.<span class="identifier2">height</span> = 418;
                debugWin.<span class="identifier2">move</span>(0, 0);
        }
        <span class="keyword">else</span>
        {
                debugWin.activate();
        }
}</pre>
<p></code></p>
<p><strong>Download</strong></p>
<p>Includes a Library Project with SWC and an example project with Source code. Â Both are for Flex 3 (but you can use in 4 if you&#8217;re so inclined). &#8211; <a href="http://jessewarden.com/archives/jxl-DebugWindowV2.zip">Download ZIP</a> | <a href="http://code.google.com/p/debugwindowv2">Source</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://jessewarden.com/2010/02/debug-window-v2-simple-flex-debug-window.html/feed</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
