<?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>WS-Blog &#187; Flash</title>
	<atom:link href="http://www.websector.de/blog/category/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.websector.de/blog</link>
	<description>// Flex - AIR - Flash - JavaScript</description>
	<lastBuildDate>Wed, 18 Jan 2012 12:17:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Speed up JPEG encoding using Alchemy</title>
		<link>http://www.websector.de/blog/2009/06/21/speed-up-jpeg-encoding-using-alchemy/</link>
		<comments>http://www.websector.de/blog/2009/06/21/speed-up-jpeg-encoding-using-alchemy/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 15:16:42 +0000</pubDate>
		<dc:creator>sectore</dc:creator>
				<category><![CDATA[Alchemy]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.websector.de/blog/?p=287</guid>
		<description><![CDATA[Few weeks ago Thibault Imbert published an optimized version of Adobes JPGEncoder. And it rocks! However, if you may have very big-size bitmaps it takes too much time to encode images. For example: A bitmap with a size of 2000px x 1500px takes 22 sec. (BTW: Adobes version 30 sec.!!) Today I came across to [...]]]></description>
			<content:encoded><![CDATA[<p>Few weeks ago <a href="http://www.bytearray.org/">Thibault Imbert</a> published an <a href="http://www.bytearray.org/?p=775">optimized version</a> of <a href="http://code.google.com/p/as3corelib/">Adobes JPGEncoder</a>. And it rocks! However, if you may have very big-size bitmaps it takes too much time to encode images. For example: A bitmap with a size of 2000px x 1500px takes 22 sec. (BTW: Adobes version 30 sec.!!) </p>
<p>Today I came across to a <a href="http://manfred.dschini.org/2008/11/21/alchemy-jpeg-encoder/">post by Manfred Weber</a>, which points to a discussion at <a href="http://forums.adobe.com/community/labs/alchemy">Adobes Alchemy forum</a>. There you will find <a href="http://forums.adobe.com/message/987186">a great solution</a> published by <a href="http://metal.hurlant.com/blog/">metalbot</a> for encoding JPEGs using <a href="http://labs.adobe.com/technologies/alchemy/">Alchemy</a>. It&#8217;s based on a <a href="http://www.ijg.org/files/">C library</a> for JPEG image compression by <a href="http://www.ijg.org/">IJG</a> and it&#8217;s pretty fast (2,7 sec. for 2000 px x 1500px ) !!! Check out the example:</p>
<p><span id="more-287"></span></p>
<h2>Example</h2>
<p>Click the image to see the live example. Feel free to post a comment about your your results!</p>
<p><a href="http://www.websector.de/blog/wp-content/uploads/2009/06/21/AlchemyJPEGEncoder.html"><img src="http://www.websector.de/blog/wp-content/uploads/2009/06/21/screen_testAlchemyJPEGEncoder.jpg" alt="Screen shot" /></a></p>
<h2>Download Full Source</h2>
<p>I have changed  the <a href="http://hurlant.com/as3_encoder_jpeg.tgz ">original C code</a> a little bit for manipulating the quality of an encoded image as well. It&#8217;s just one line added to &#8220;as3_jpeg_wrapper.gg&#8221; (line 78) <code>jpeg_set_quality(&#038;cinfo, quality, TRUE /* limit to baseline-JPEG values */);</code> Therefore the &#8220;as3_jpeg_wrapper.swc&#8221; located within the *.zip is recompiled for using this feature in your Flex project via  <code>as3_jpeg_wrapper.write_jpeg_file(baSource, WIDTH, HEIGHT, 3, 2, quality);</code> </p>
<p>Full source of the Flex based example above: <a href="http://www.websector.de/blog/?download=AlchemyJPEGEncoderFlexExample">AlchemyJPEGEncoderFlexExample.zip</a> (Downloads: 4207)</p>
<p>BTW: You will find the original source of all C based classes published by metalbot <a href="http://forums.adobe.com/message/987186#987186">here</a>.  </p>
<h2>Tips</h2>
<p>I struggled around to set up Alchemy and to recompile the IJG library and the &#8220;as3_jpeg_wrapper.swc&#8221;. To avoid this, here are some tips:</p>
<ul>
<li><a href="http://www.zeropointnine.com/wiki/index.php?n=FlashPlatform.Alchemy">Instruction for set up Alchemy</a> by <a href="http://www.zeropointnine.com/blog/">Lee Felarca</a>   (zeropointnine). Best instruction I&#8217;ve found so far for set up Alchemy.</li>
<li>Recompiling the SWC of metalbot&#8217;s source following its &#8220;README.txt&#8221; and using its &#8220;Makefile&#8221; failed: To avoid this issue, after compiling the C library of jpegsrc you have to move the following files to $ALCHEMY_HOME/jpeg/ as well: &#8220;jconfig.h&#8221;, &#8220;jmorecfg.h&#8221; and &#8220;jpeglib.h&#8221;. Check out <a href="http://forums.adobe.com/message/1059134#1059134">the comment by notnick here</a></li>
</ul>
<p><strong>[UPDATE 06/22/09]</strong> There is another great test for encoding images using Alchemy by <a href="http://segfaultlabs.com/">Mateusz Malczak</a>, which includes an asynchrounous example as well: <a href="http://segfaultlabs.com/blog/post/asynchronous-jpeg-encoding">Alchemy &#8211; asynchronous jpeg encoding</a> Thanks to <a href="http://twitter.com/xoestudio">xoestudio</a> for pointing to this via twitter! <strong>[UPDATE] </strong></p>
<p>Have fun <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>-Jens</p>
]]></content:encoded>
			<wfw:commentRss>http://www.websector.de/blog/2009/06/21/speed-up-jpeg-encoding-using-alchemy/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>ThunderBolt AS3 version 2.2 out now!</title>
		<link>http://www.websector.de/blog/2009/03/08/thunderbolt-as3-version-22-out-now/</link>
		<comments>http://www.websector.de/blog/2009/03/08/thunderbolt-as3-version-22-out-now/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 16:33:31 +0000</pubDate>
		<dc:creator>sectore</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[ThunderBolt]]></category>

		<guid isPermaLink="false">http://www.websector.de/blog/?p=262</guid>
		<description><![CDATA[ThunderBolt AS3, which is a lightweight logger extension for Flex 3-4, AIR and Flash 9-10 applications, has been updated to version 2.2. Check out the new features: New features Logging of package names + class names + code line numbers (Flash Debug Player required). ThunderBoltTarget for using Flex Logging API improved. SWC updated for using [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.google.com/p/flash-thunderbolt/" class="img"><img src="http://www.websector.de/blog/wp-content/uploads/2009/03/08/ThunderBoltAS3_teaser.png" width="500" height="90" /></a></p>
<p><a href="http://code.google.com/p/flash-thunderbolt/">ThunderBolt AS3</a>, which is a lightweight logger extension for Flex 3-4, AIR and Flash 9-10 applications, has been updated to version 2.2. </p>
<p>Check out the <a href="http://www.websector.de/blog/2009/03/08/thunderbolt-as3-version-22-out-now">new features</a>:</p>
<p><span id="more-262"></span></p>
<h2>New features</h2>
<ol>
<li>Logging of package names + class names + code line numbers (Flash Debug Player required).
<p><img src="http://www.websector.de/blog/wp-content/uploads/2009/03/08/thunderbolt_codelinenumbers.png" width="494" height="296" /></p>
</li>
<li><a href="http://code.google.com/p/flash-thunderbolt/source/browse/trunk/as3/source/org/osflash/thunderbolt/ThunderBoltTarget.as">ThunderBoltTarget</a> for using <a href="http://livedocs.adobe.com/flex/3/html/logging_09.html">Flex Logging API</a> improved.</li>
<li><a href="http://code.google.com/p/flash-thunderbolt/source/browse/#svn/trunk/as3/libs">SWC</a> updated for using Flex 4 (<a href="http://opensource.adobe.com/wiki/display/flexsdk/Gumbo">Gumbo</a>)</li>
<li><a href="http://code.google.com/p/flash-thunderbolt/wiki/ThunderBoltAS3Console">ThunderBolt AS3 Console</a> uses a certificate of <a href="http://www.thawte.com/">Thawte</a> sponsored by <a href="http://www.adobe.com/">Adobe</a>.
<p><img src="http://www.websector.de/blog/wp-content/uploads/2009/03/08/thunderbolt_certificate.png" width="500" height="410" /></p>
</li>
<li><a href="http://code.google.com/p/flash-thunderbolt/wiki/ThunderBoltAS3Console">ThunderBolt AS3 Console</a> is updated using latest version of <a href="http://get.adobe.com/air/">Adobe AIR v.1.5.1</a></li>
<li><a href="http://code.google.com/p/flash-thunderbolt/issues/detail?id=10">Issue 10</a> fixed: &#8220;<a href="http://code.google.com/p/flash-thunderbolt/issues/detail?id=10">Command + Q not working in OS X</a>&#8220;</li>
<li>All <a href="http://code.google.com/p/flash-thunderbolt/downloads/list">examples</a> and <a href="http://code.google.com/p/flash-thunderbolt/w/list">documentation</a> has been updated as well.</li>
</ol>
<p>Happy Logging <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>-Jens</p>
]]></content:encoded>
			<wfw:commentRss>http://www.websector.de/blog/2009/03/08/thunderbolt-as3-version-22-out-now/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>WSPluginSwitcher: Cocoa based tool for switching Flash plug-in on OS X</title>
		<link>http://www.websector.de/blog/2009/01/02/wspluginswitcher-cocoa-based-tool-for-switching-flash-plug-in-on-os-x/</link>
		<comments>http://www.websector.de/blog/2009/01/02/wspluginswitcher-cocoa-based-tool-for-switching-flash-plug-in-on-os-x/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 15:54:12 +0000</pubDate>
		<dc:creator>sectore</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://www.websector.de/blog/?p=104</guid>
		<description><![CDATA[It&#8217;s never to late to learn a new (programming) language So I&#8217;ve been starting to learn Cocoa, Apple&#8217;s Objective-C based programming environment for Mac OS X. My &#8220;Cocoa&#8221;-trip started with building a little application called &#8220;WSPluginSwitcher&#8220;, which is a Cocoa based tool for switching Flash plug-ins on OS X (Leopard). Check it out &#8211; it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.google.com/p/wspluginswitcher/" class="img"><br />
<img src="http://www.websector.de/blog/wp-content/uploads/2009/01/02/logo450x76.png" width="450" height="76"  /></a></p>
<p>It&#8217;s never to late to learn a new (programming) language <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  So I&#8217;ve been starting to learn <a href="http://developer.apple.com/cocoa/ ">Cocoa</a>, Apple&#8217;s Objective-C based programming environment for Mac OS X. </p>
<p>My &#8220;Cocoa&#8221;-trip started with building a little application called &#8220;<a href="http://code.google.com/p/wspluginswitcher/">WSPluginSwitcher</a>&#8220;, which is a Cocoa based tool for switching Flash plug-ins on OS X (Leopard). </p>
<p><span id="more-104"></span></p>
<p>Check it out &#8211; it&#8217;s open source, including its source code: <a href="http://code.google.com/p/wspluginswitcher/">WSPluginSwitcher on Google Code</a></p>
<h2>Screen shots</h2>
<p><a href="http://code.google.com/p/wspluginswitcher/" class="img"><img src="http://www.websector.de/blog/wp-content/uploads/2009/01/02/WSPluginSwitcher_mainWindow.png" width="328" height="390"  /></a></p>
<p><a href="http://code.google.com/p/wspluginswitcher/" class="img"><img src="http://www.websector.de/blog/wp-content/uploads/2009/01/02/WSPluginSwitcher_prefsWindow.png" width="352" height="303"  /></a></p>
<p><a href="http://code.google.com/p/wspluginswitcher/" class="img"><img src="http://www.websector.de/blog/wp-content/uploads/2009/01/02/WSPluginSwitcher_desktopIcon.png" width="510" height="217"  /></a></p>
<h2>Download WSPluginSwitcher including full source</h2>
<p>You can download WSPluginSwitcher at its <a href="http://code.google.com/p/wspluginswitcher/">Google Code project</a>.</p>
<p>To get the full source checkout the latest code using <a href="http://code.google.com/p/wspluginswitcher/source/checkout">WSPluginSwitchers repository</a> at Google Code. </p>
<p>It&#8217;s open source!</p>
<p>BTW: I&#8217;m very new to Cocoa, so I&#8217;m very happy about any feedback <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h2>Helpful links for learning Cocoa as an ActionScript Developer</h2>
<p>About 10 days of programming a new language is not enough to make a real statement&#8230; However, what I&#8217;ve have learned so far is: <strong>To learn Cocoa as quick as possible you will need a good book!</strong> Apple delivers <a href="http://developer.apple.com/documentation/Cocoa/index.html">tons of Cocoa guides</a>, but it takes me (too) much time to find basic solutions. I know why I love Adobes Flex and AIR docs <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </p>
<p>So I highly recommend the book called <a href="http://www.amazon.com/Cocoa-Programming-Mac-OS-3rd/dp/0321503619/">&#8220;Cocoa Programming for Max OS X&#8221; by Aaron Hillegass</a>, which helps me a lot!</p>
<p>Further helpful links (not only for ActionScript Developers) are:</p>
<ul>
<li><a href="http://cocoadevcentral.com/">Cocoa Dev Central</a>: <a href="http://cocoadevcentral.com/">Learn Cocoa</a></li>
<li><a href="http://theocacao.com/">Theocacao</a>: <a href="http://theocacao.com/document.page/510">A Quick Objective-C 2.0 Tutorial</a></li>
<li><a href="http://andyj.be/blog/">Andy Jacobs</a>: &#8220;<a href="http://andyj.be/blog/?p=3">Cocoa touch for actionscript developers (basics)</a>&#8220;, &#8220;<a href="http://andyj.be/blog/?p=25">AS3 to Cocoa Touch: Array’s</a>&#8220;, &#8220;<a href="http://andyj.be/blog/?p=37">AS3 to Cocoa touch: XML</a>&#8220;, &#8220;<a href="http://andyj.be/blog/?p=52">AS3 to Cocoa touch: JSON (Part 1)</a>&#8221;
<li><a href="http://www.bit-101.com/blog/">Keith Peters:</a> Gravity Tutorials for iPhone <a href="http://www.bit-101.com/blog/?p=1784">Part 1</a>, <a href="http://www.bit-101.com/blog/?p=1793">Part 2</a>, <a href="http://www.bit-101.com/blog/?p=1798">Part 3</a>, <a href="http://www.bit-101.com/blog/?p=1812">Part 4</a>, <a href="http://www.bit-101.com/blog/?p=1824">Part 5</a></li>
</ul>
<p>P.S.: Happy Flash plug-in switching using WSPluginSwitcher! <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.websector.de/blog/2009/01/02/wspluginswitcher-cocoa-based-tool-for-switching-flash-plug-in-on-os-x/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>10 tips and tricks using ThunderBolt AS3</title>
		<link>http://www.websector.de/blog/2008/06/15/10-tips-and-tricks-using-thunderbolt-as3/</link>
		<comments>http://www.websector.de/blog/2008/06/15/10-tips-and-tricks-using-thunderbolt-as3/#comments</comments>
		<pubDate>Sun, 15 Jun 2008 10:02:00 +0000</pubDate>
		<dc:creator>sectore</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[ThunderBolt]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Almost one year ago I started to develop a small extension called ThunderBolt AS3 for logging ActionScript 3 applications using Firebug as simple as possible. Today its nice to see that the community uses and supports this extension as well. For all those who not familiar with it: ThunderBolt AS3 is a lightweight logger extension [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.websector.de/blog/2007/04/21/logging-flex-2-and-as-3-apps-with-firebug-and-thunderbolt/">Almost one year ago</a> I started to develop a small extension called <a href="http://code.google.com/p/flash-thunderbolt/wiki/ThunderBoltAS3">ThunderBolt AS3</a> for logging ActionScript 3 applications using <a href="http://www.getfirebug.com/">Firebug</a> as simple as possible. Today its nice to see that the community <a href="http://www.flashcomguru.com/index.cfm/2008/6/6/thunderbolt-air">uses</a> <a href="http://www.flex888.com/2008/06/14/debugging-flex-with-thunderbolt.html">and</a> <a href="http://blog.digitalbackcountry.com/?p=1452">supports</a> this extension as well.</p>
<p>For all those who not familiar with it: <a href="http://code.google.com/p/flash-thunderbolt/wiki/ThunderBoltAS3">ThunderBolt AS3</a> is a lightweight logger extension for any ActionScript 3 applications based on <a href="http://www.adobe.com/products/flash/">Flash CS3</a>, <a href="http://www.adobe.com/products/flex/">Flex</a> or <a href="http://www.adobe.com/products/air/">Adobe AIR</a> using <a href="http://www.getfirebug.com/">Firebug</a> or its own <a href="http://www.websector.de/blog/2008/06/01/the-new-thunderbolt-as3-console-is-based-on-adobe-air/">ThunderBolt AS3 Console</a>.</p>
<p>Here are some tips and tricks using ThunderBolt AS3:</p>
<p><span id="more-51"></span></p>
<ol>
<li>
<h2>Using different log levels</h2>
<p>ThunderBolt AS3 supports different log levels, which based on the supported levels by Firebug, such as &#8220;info&#8221;, &#8220;warn&#8221;, &#8220;error&#8221; or &#8220;debug&#8221;. It&#8217;s pretty simple to use it:</p>
<phpcode>
<div class="codeHeadlineBox">
<p>log level example ( <a href="http://www.websector.de/blog/wp-content/uploads/2008/06/15/loglevels.as">Download code</a> )</p>
</div>
<div class="actionscript" style="font-family: monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw3">import</span> org.<span class="me1">osflash</span>.<span class="me1">thunderbolt</span>.<span class="me1">Logger</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// some log objects</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> myNumber: <span class="kw3">int</span> = <span class="nu0">5</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> myString: <span class="kw3">String</span> = <span class="st0">&quot;Lorem ipsum&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// INFO log level</span></div>
</li>
<li class="li1">
<div class="de1">Logger.<span class="me1">info</span> <span class="br0">&#40;</span><span class="st0">&quot;Just an info message&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// DEBUG log level</span></div>
</li>
<li class="li1">
<div class="de1">Logger.<span class="me1">debug</span> <span class="br0">&#40;</span><span class="st0">&quot;A debug log &quot;</span>, myString<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// WARN log level</span></div>
</li>
<li class="li1">
<div class="de1">Logger.<span class="me1">warn</span> <span class="br0">&#40;</span><span class="st0">&quot;A warn message&quot;</span>, myNumber<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// ERROR log level</span></div>
</li>
<li class="li1">
<div class="de1">Logger.<span class="kw3">error</span> <span class="br0">&#40;</span><span class="st0">&quot;An error log &quot;</span>, myString<span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
</phpcode>
<p><strong>Screen shot using Firebug:</strong><br />
			<img src="http://www.websector.de/blog/wp-content/uploads/2008/06/15/loglevels.png" width="498" height="224" />
			</p>
<p><strong>Screen shot using ThunderBolt AS3 Console:</strong><br />
				<img src="http://www.websector.de/blog/wp-content/uploads/2008/06/15/loglevels2.png" width="498" height="356" />
				</p>
</li>
<li>
<h2>Logging one or more objects at once</h2>
<p>ThunderBolt AS3 logs more than one objects at once. It could be primitive types (<code>int</code>, <code>uint</code>, <code>Number</code>, <code>Boolean</code>, &#8230;) or more complex data such as an instance of any classes or nested objects. Here an example:</p>
<phpcode>
<div class="codeHeadlineBox">
<p>Example for logging few objects at once ( <a href="http://www.websector.de/blog/wp-content/uploads/2008/06/15/objects.as">Download code</a> )</p>
</div>
<div class="actionscript" style="font-family: monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw3">import</span> org.<span class="me1">osflash</span>.<span class="me1">thunderbolt</span>.<span class="me1">Logger</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// some log objects</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> myNumber: <span class="kw3">int</span> = <span class="nu0">5</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> myString: <span class="kw3">String</span> = <span class="st0">&quot;Lorem ipsum&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> myObject: <span class="kw3">Object</span> = <span class="br0">&#123;</span>&nbsp; &nbsp; exampleArray: <span class="br0">&#91;</span><span class="st0">&quot;firstValue&quot;</span>, <span class="st0">&quot;secondValue&quot;</span><span class="br0">&#93;</span>, </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y: <span class="nu0">10</span>, </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exampleString: <span class="st0">&quot;Hello&quot;</span>, </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nestedObject: <span class="br0">&#123;</span>&nbsp;x: <span class="nu0">100</span>, </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y: <span class="nu0">200</span><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Logging an object with nested items</span></div>
</li>
<li class="li1">
<div class="de1">Logger.<span class="me1">info</span> <span class="br0">&#40;</span><span class="st0">&quot;Logging an object with nested items &quot;</span>, myObject<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Logging more objects at once</span></div>
</li>
<li class="li1">
<div class="de1">Logger.<span class="me1">info</span> <span class="br0">&#40;</span><span class="st0">&quot;Logging more objects at once &quot;</span>, myString, myNumber, myObject<span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
</phpcode>
<p><strong>Screen shot using Firebug:</strong><br />
				<img src="http://www.websector.de/blog/wp-content/uploads/2008/06/15/objects.png" width="498" height="224" />
				</p>
<p><strong>Screen shot using ThunderBolt AS3 Console:</strong><br />
					<img src="http://www.websector.de/blog/wp-content/uploads/2008/06/15/objects2.png" width="498" height="356" />
					</p>
</li>
<li>
<h2>Using the Flex Logging API</h2>
<p>ThunderBolt AS3 supports the <a href="http://livedocs.adobe.com/flex/3/html/logging_09.html#178687">Flex Logging API</a> using its own log target called <code>ThunderBoltTarget</code>. To use it you will need to use and import the <a href="http://code.google.com/p/flash-thunderbolt/source/browse/trunk/as3/source/org/osflash/thunderbolt/ThunderBoltTarget.as">ThunderBoltTarget.as</a> as well:</p>
<phpcode>
<div class="codeHeadlineBox">
<p>Example for using Flex logging API ( <a href="http://www.websector.de/blog/wp-content/uploads/2008/06/15/flexapi.as">Download code</a> )</p>
</div>
<div class="actionscript" style="font-family: monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="kw3">import</span> mx.<span class="me1">logging</span>.<span class="kw3">Log</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">import</span> org.<span class="me1">osflash</span>.<span class="me1">thunderbolt</span>.<span class="me1">ThunderBoltTarget</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// init ThunderBoltTarget</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">_target</span> = <span class="kw2">new</span> ThunderBoltTarget<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/*&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI"> You can disable the time, level or category as well&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI"> _target.includeTime = false;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI"> _target.includeLevel = false;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI"> _target.includeCategory = false;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">*/</span>&nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">_target</span>.<span class="me1">filters</span> = <span class="br0">&#91;</span><span class="st0">&quot;de.websector.playground.ThunderBoltTargetExample&quot;</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">Log</span>.<span class="me1">addTarget</span><span class="br0">&#40;</span><span class="kw3">_target</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// start logging</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">Log</span>.<span class="me1">getLogger</span><span class="br0">&#40;</span><span class="st0">&quot;de.websector.playground.ThunderBoltTargetExample&quot;</span><span class="br0">&#41;</span>.<span class="me1">info</span><span class="br0">&#40;</span><span class="st0">&quot;Just an info message.&quot;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
</phpcode>
<p><strong>Screen shot using Firebug:</strong><br />
			<img src="http://www.websector.de/blog/wp-content/uploads/2008/06/15/flexapi.png" width="498" height="150" />
			</p>
<p><strong>Screen shot using ThunderBolt AS3 Console:</strong><br />
				<img src="http://www.websector.de/blog/wp-content/uploads/2008/06/15/flexapi2.png" width="498" height="234" />
				</p>
</li>
<li>
<h2>Stop and hide logging</h2>
<p>To release your project you might to disable all logging data. Then put the following line into your code.</p>
<phpcode>
<div class="actionscript" style="font-family: monospace;">
<ol>
<li class="li1">
<div class="de1">Logger.<span class="kw3">hide</span> = <span class="kw2">true</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
</phpcode></li>
<li>
<h2>Show a memory snapshot</h2>
<p>Make a memory snapshot whenever you want:</p>
<phpcode>
<div class="actionscript" style="font-family: monospace;">
<ol>
<li class="li1">
<div class="de1">Logger.<span class="me1">memorySnapshot</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
</phpcode></li>
<li>
<h2>Show or hide a time stamp</h2>
<p>Lets make a time stamp. The default value is &#8220;true&#8221;. To hide the time stamp use this:</p>
<phpcode>
<div class="actionscript" style="font-family: monospace;">
<ol>
<li class="li1">
<div class="de1">Logger.<span class="me1">includeTime</span> = <span class="kw2">false</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
</phpcode></li>
<li>
<h2>Using the new ThunderBolt AS3 <strike>v.2.1beta</strike> v.2.0 and its Console</h2>
<p><a href="http://code.google.com/p/flash-thunderbolt/downloads/list">The new version of ThunderBolt AS3</a> (<strike>v.2.1beta</strike> v.2.0) detects either Firebug is installed or not. If not, then it uses the well known <code>trace()</code> method to log all data into &#8220;flashlog.txt&#8221;. You can enforce this process using:</p>
<phpcode>
<div class="actionscript" style="font-family: monospace;">
<ol>
<li class="li1">
<div class="de1">Logger.<span class="me1">console</span> = <span class="kw2">true</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
</phpcode>
<p>To show all information in a well defined structure I&#8217;d recommend to use the new <a href="http://code.google.com/p/flash-thunderbolt/wiki/ThunderBoltAS3Console">ThunderBolt AS3 Console</a>. It&#8217;s a handy tool to log any AIR application as well <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  </p>
</li>
<li>
<h2>Using the ThunderBolt AS3 Console for logging ActionScript 1 or 2 projects</h2>
<p>As described above <a href="http://code.google.com/p/flash-thunderbolt/wiki/ThunderBoltAS3Console">ThunderBolt AS3 Console</a> follows a simple principle: It reads just all information logged by the ThunderBolt AS3 Logger (<strike>v.2.1beta</strike> v.2.0) into &#8220;flashlog.txt&#8221; and shows it in a hierarchal order based on different log levels. </p>
<p>That means you can use ThunderBolt AS3 Console for logging any AS 1 or 2 projects too <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  . Just call a <code>trace()</code> method as follows. Note the prefixes named &#8220;info&#8221;, &#8220;error&#8221;, &#8220;warn&#8221; or &#8220;debug&#8221; followed by a whitespace at the beginning:</p>
<phpcode>
<div class="codeHeadlineBox">
<p>trace() example for using ThunderBolt AS3 Console ( <a href="http://www.websector.de/blog/wp-content/uploads/2008/06/15/trace.as">Download code</a> )</p>
</div>
<div class="actionscript" style="font-family: monospace;">
<ol>
<li class="li1">
<div class="de1"><span class="co1">//</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// tracing an info log level</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">trace</span> <span class="br0">&#40;</span><span class="st0">&quot;info Here is an info message to display using ThunderBolt AS3 Console&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// tracing an error log level</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> myString: <span class="kw3">String</span> = <span class="st0">&quot;hello console&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">trace</span> <span class="br0">&#40;</span><span class="st0">&quot;error Here is an error message&quot;</span> + myString<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// tracing an debug log level</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">trace</span> <span class="br0">&#40;</span><span class="st0">&quot;debug Here is a debug message&quot;</span> + myString<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// tracing a warn log level</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">trace</span> <span class="br0">&#40;</span><span class="st0">&quot;warn Here is a warn message&quot;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
</phpcode>
<p><strong>Screen shot using ThunderBolt AS3 Console:</strong><br />
				<img src="http://www.websector.de/blog/wp-content/uploads/2008/06/15/trace.png" width="498" height="294" />
				</p>
</li>
<li>
<h2>Any issues with the Flash Player security sandbox using Firebug?</h2>
<p>If you have any security issues with the Flash Player security sandbox using ThunderBolt AS3 and Firebug set within your HTML template the value of the parameter named &#8220;allowScriptAccess&#8221; to &#8220;always&#8221;. For more information check Adobes Flex 3 Help: <a href="http://livedocs.adobe.com/flex/3/html/passingarguments_6.html">&#8220;About ExternalInterface API security in Flex&#8221;</a></p>
</li>
<li>
<h2>Issues using ThunderBolt AS3 Console on Windows?</h2>
<p>What a pretty sh&#8230;y thing: The ThunderBolt AS3 Console is currently available for OS X only. There are some issues using an opened AIR app and &#8220;flashlog.txt&#8221; at the same time on Windows. Check out <a href="http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=75&#038;catid=697&amp;threadid=1368880">this entry at Adobes AIR forum</a> for more information. Hoping that Adobe will fix this issue in the future. So long, sorry for all the Windows user out there <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' />  . </p>
<p>BTW: Feel free to post <a href="http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=75&#038;catid=697&amp;threadid=1368880">here</a> your request to Adobes AIR team as well <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  </p>
</li>
</ol>
<h2>Open source!</h2>
<p>ThunderBolt AS3 and its console is open source! <a href="http://code.google.com/p/flash-thunderbolt/source/checkout">Grab the source</a>, change and adapt it. Or do whatever you want <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  </p>
<p>Happy logging! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.websector.de/blog/2008/06/15/10-tips-and-tricks-using-thunderbolt-as3/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>The new ThunderBolt AS3 Console based on Adobe AIR</title>
		<link>http://www.websector.de/blog/2008/06/01/the-new-thunderbolt-as3-console-based-on-adobe-air/</link>
		<comments>http://www.websector.de/blog/2008/06/01/the-new-thunderbolt-as3-console-based-on-adobe-air/#comments</comments>
		<pubDate>Sun, 01 Jun 2008 17:23:00 +0000</pubDate>
		<dc:creator>sectore</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[ThunderBolt]]></category>

		<guid isPermaLink="false">http://www.websector.de/blog/2008/06/01/the-new-thunderbolt-as3-console-based-on-adobe-air/</guid>
		<description><![CDATA[ThunderBolt AS3 is a lightweight logger extension for Flex or Flash application using Firebug. With its new tool called ThunderBolt AS3 Console, which based on Adobe AIR, it&#8217;s independent on Firebug. That&#8217;s incredible helpful for logging AIR applications using ThunderBolt AS3. Screen shots 
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_ws-slideshow_650694399"
			class="flashmovie"
			width="500"
			height="400">
	<param name="movie" value="http://www.websector.de/blog/wp-includes/swf/ws-slideshow.swf" />
	<param name="flashvars" value="XMLPath=http://www.websector.de/blog/wp-content/uploads/2008/06/01/screenshots.xml&amp;langID=EN" />
	<param name="menu" value="false" />
	<param name="bgcolor" value="#FFFFFF" />
	<param name="allowscriptaccess" value="sameDomain" />
	<param name="allowfullscreen" value="true" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.websector.de/blog/wp-includes/swf/ws-slideshow.swf"
			name="fm_ws-slideshow_650694399"
			width="500"
			height="400">
		<param name="flashvars" value="XMLPath=http://www.websector.de/blog/wp-content/uploads/2008/06/01/screenshots.xml&amp;langID=EN" />
		<param name="menu" value="false" />
		<param name="bgcolor" value="#FFFFFF" />
		<param name="allowscriptaccess" value="sameDomain" />
		<param name="allowfullscreen" value="true" />
	<!--<![endif]-->
		 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.google.com/p/flash-thunderbolt/wiki/ThunderBoltAS3">ThunderBolt AS3</a> is a lightweight logger extension for Flex or Flash application using <a href="http://www.firebug.org">Firebug</a>. With its new tool called <a href="http://code.google.com/p/flash-thunderbolt/wiki/ThunderBoltAS3Console">ThunderBolt AS3 Console</a>, which based on <a href="http://www.adobe.com/products/air/">Adobe AIR</a>, it&#8217;s independent on Firebug. That&#8217;s incredible helpful for logging AIR applications using ThunderBolt AS3.</p>
<p><span id="more-50"></span></p>
<h2>Screen shots</h2>
<p>[kml_flashembed publishmethod="dynamic" fversion="9.0.28" movie="http://www.websector.de/blog/wp-includes/swf/ws-slideshow.swf" width="500" height="400" targetclass="flashmovie" menu="false" bgcolor="#FFFFFF" allowfullscreen="true" allowscriptaccess="sameDomain" fvars="XMLPath=http://www.websector.de/blog/wp-content/uploads/2008/06/01/screenshots.xml;langID=EN"]</a><br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p><!-- #START screenshots --></p>
<h2>Behind the scenes</h2>
<p>For logging without Firebug, ThunderBolt AS3 uses the well-known <code>trace()</code> method in a special manner, which are stored in the <a href="http://livedocs.adobe.com/flex/3/html/logging_04.html">flashlog.txt</a>. ThunderBolt AS3 Console reads this file and displays all information using different log views in a same way as Firebug it does.</p>
<p>The architecture behind this AIR application based on <a href="http://www.tombray.com/category/easymvc/">Tom Bray&#8217;s easyMVC concept</a>, which helps to build a well structured application as quick as possible using the MVC pattern.</p>
<p>ThunderBolt AS3 Console uses the following libraries as well:</p>
<ul>
<li><a href="http://developer.yahoo.com/yui/treeview/">Yahoo! UI Library TreeView</a> for the logging tree. It&#8217;s great to use this library within <a href="http://livedocs.adobe.com/flex/3/langref/mx/controls/HTML.html">the AIR based HTML component</a> for manipulating the HTML DOM using pure ActionScript <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  .</li>
<li>The awesome <a href="http://www.degrafa.com/">Degrafa</a> library for all the skinning stuff.</li>
</ul>
<h2>Full source available</h2>
<p>Download the <a href="http://code.google.com/p/flash-thunderbolt/downloads/list">ThunderBolt AS3 Console at Google Code</a> or check out the full source using <a href="http://flash-thunderbolt.googlecode.com/svn/trunk/as3console/">its repository</a>.</p>
<h2>Wiki pages at Google Code</h2>
<ul>
<li><a href="http://code.google.com/p/flash-thunderbolt/wiki/ThunderBoltAS3">ThunderBolt AS3 project page</a></li>
<li><a href="http://code.google.com/p/flash-thunderbolt/wiki/ThunderBoltAS3Console">ThunderBolt AS3 Console</a></li>
</ul>
<p>Happy logging! <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.websector.de/blog/2008/06/01/the-new-thunderbolt-as3-console-based-on-adobe-air/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>PureMVC’s &#8220;Best Practices Document&#8221; has been translated into German</title>
		<link>http://www.websector.de/blog/2008/05/11/puremvc%e2%80%99s-best-practices-document-has-been-translated-into-german/</link>
		<comments>http://www.websector.de/blog/2008/05/11/puremvc%e2%80%99s-best-practices-document-has-been-translated-into-german/#comments</comments>
		<pubDate>Sun, 11 May 2008 14:59:00 +0000</pubDate>
		<dc:creator>sectore</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PureMVC]]></category>

		<guid isPermaLink="false">http://www.websector.de/blog/2008/05/11/puremvc%e2%80%99s-best-practices-document-has-been-translated-into-german/</guid>
		<description><![CDATA[It&#8217;s done! It takes me few days to translate the great documentation called &#8220;PureMVC &#8211; Implementation, Idioms and Best Practices&#8221; published by Cliff Hall into German. Anyway, it was worth it! 52 pages about using PureMVC in a right way including examples, tips and general information using design patterns. Study this document published in English, [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s done! It takes me few days to translate the great documentation called &#8220;PureMVC &#8211; Implementation, Idioms and Best Practices&#8221; published by <a href="http://futurescale.com/">Cliff Hall</a> into German. Anyway, it was worth it! 52 pages about using <a href="http://puremvc.org/">PureMVC</a> in a right way including examples, tips and general information using <a href="http://en.wikipedia.org/wiki/Design_Patterns">design patterns</a>.</p>
<p><span id="more-49"></span></p>
<p>Study this document published in <a href="http://puremvc.org/">English, France and now in German</a>, and you will have the perfect knowledge about building well structured applications based on <a href="http://www.adobe.com/products/flash/">Flash</a>, <a href="http://www.adobe.com/products/flex/">Flex</a> or <a href="http://www.adobe.com/products/air/">AIR</a> using <a href="http://puremvc.org/">PureMVC</a>. Believe me, you don&#8217;t have to dig tons of resources, blog entries or forums, just study this document!</p>
<p>Grab the the &#8220;Best Practices&#8221; at the <a href="http://puremvc.org/">official PureMVC site</a>! The German version will be there available within the next few days as well.</p>
<h2>Cover of PureMVC&#8217;s &#8220;Best Practices Document&#8221; in German</h2>
<p><img src="http://www.websector.de/blog/wp-content/uploads/2008/05/11/puremvc_doc_cover.png" width="500" height="640" alt="PureMVC - Best Practices Document in German - Cover" id="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.websector.de/blog/2008/05/11/puremvc%e2%80%99s-best-practices-document-has-been-translated-into-german/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Voices on PureMVC: An interview with Cliff Hall</title>
		<link>http://www.websector.de/blog/2008/02/11/voices-on-puremvc-an-interview-with-cliff-hall/</link>
		<comments>http://www.websector.de/blog/2008/02/11/voices-on-puremvc-an-interview-with-cliff-hall/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 09:44:39 +0000</pubDate>
		<dc:creator>sectore</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PureMVC]]></category>

		<guid isPermaLink="false">http://www.websector.de/blog/2008/02/11/voices-on-puremvc-an-interview-with-cliff-hall/</guid>
		<description><![CDATA[Cliff Hall, the founder of the PureMVC project, has recently opened a Blog called &#8220;Voices on PureMVC&#8221; and has started a &#8220;Voices Podcast&#8221;, too. At the first episode we&#8217;ve talked about some PureMVC demos I&#8217;ve created as well as about the experiences using PureMVC in my professional work. It was a lot of fun! Check [...]]]></description>
			<content:encoded><![CDATA[<p>Cliff Hall, the founder of the <a href="http://puremvc.org/">PureMVC project</a>, has recently opened a Blog called &#8220;Voices on PureMVC&#8221; and has started a &#8220;Voices Podcast&#8221;, too. </p>
<p><a href="http://puremvc.org/content/view/70/1/">At the first episode</a> we&#8217;ve talked about some PureMVC demos I&#8217;ve created as well as about the experiences using PureMVC in my professional work. It was a lot of fun!</p>
<p><span id="more-46"></span></p>
<p><a href="http://puremvc.org/content/view/70/1/">Check it out</a> <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> !</p>
<p>P.S. Cliff, thanks for the great interview! I&#8217;m very proud to be a voice of PureMVC <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.websector.de/blog/2008/02/11/voices-on-puremvc-an-interview-with-cliff-hall/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WS-ThumbsGenerator: Using the drag-and-drop and file system APIs with Adobes JPEGEncoder to create image thumbnails</title>
		<link>http://www.websector.de/blog/2008/02/01/ws-thumbsgenerator-using-the-drag-and-drop-and-file-system-apis-with-adobes-jpegencoder-to-create-image-thumbnails/</link>
		<comments>http://www.websector.de/blog/2008/02/01/ws-thumbsgenerator-using-the-drag-and-drop-and-file-system-apis-with-adobes-jpegencoder-to-create-image-thumbnails/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 11:45:00 +0000</pubDate>
		<dc:creator>sectore</dc:creator>
				<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.websector.de/blog/2008/02/01/ws-thumbsgenerator-using-the-drag-and-drop-and-file-system-apis-with-adobes-jpegencoder-to-create-image-thumbnails/</guid>
		<description><![CDATA[[UPDATE: 03/02/08] The source has been updated using Adobes AIR 1.0. For a current project called &#8220;WS-Slideshow&#8221; I&#8217;ve started to develop a tool, which allows the user to customize its own &#8220;WS-Slideshow&#8221; pretty easy. It based on Adobes AIR Beta 3 Adobes AIR 1.0. The current prototype implements the drag-and-drop and file system API&#8217;s using [...]]]></description>
			<content:encoded><![CDATA[<p style="background-color: #f6f6f6"><strong>[UPDATE: 03/02/08]</strong> <a href="#download">The source</a> has been updated using Adobes AIR 1.0.</p>
<p>For a current project called &#8220;<a href="http://www.ws-slideshow.com/">WS-Slideshow</a>&#8221; I&#8217;ve started to develop a tool, which allows the user to customize its own &#8220;WS-Slideshow&#8221; pretty easy. It based on <span style="text-decoration: line-through;">Adobes AIR Beta 3</span> <a href="http://www.adobe.com/products/air/">Adobes AIR 1.0</a>.<br />
<span id="more-45"></span><br />
 The current prototype implements the drag-and-drop and file system API&#8217;s using <a href="http://code.google.com/p/as3corelib/">Adobes JPEGEncoder</a> to create image thumbnails quick and easy. Therefore the prototype is called &#8220;WS-ThumbsGenerator&#8221; . </p>
<p>The code behind based on <a href="http://www.tombray.com/">Tom Bray&#8217;s</a> <a href="http://www.tombray.com/category/easymvc/">easyMVC concept</a>, which is the first choice for such prototypes like &#8220;WS-ThumbsGenerator&#8221;. Fore more information about easyMVC check out <a href="http://www.clockobj.co.uk/2007/10/17/simplified-cairngorm-easy-mvc-for-adobe-flex">the excellent tutorial</a> of <a href="http://clockobj.co.uk/">Jon Baker</a> as well. </p>
<p>Anyway, I&#8217;ve decided to share the <a href="#download">full source of the prototype</a> for the community, it may be helpful for anyone.</p>
<p>BTW: The &#8220;<a href="http://www.ws-slideshow.com/">WS-Slideshow</a>&#8221; is a free Flash based slide show developed in AS3 using <a href="http://www.puremvc.org">PureMVC</a>. A desktop version based on Adobes AIR is in process. <a href="http://www.ws-slideshow.com/">Check it out!</a></p>
<h2>Screen shots</h2>
<p><!-- ws-slideshow --></p>
<div width="500" height="400">

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_ws-slideshow_1425907062"
			class="flashmovie"
			width="500"
			height="400">
	<param name="movie" value="http://www.websector.de/blog/wp-includes/swf/ws-slideshow.swf" />
	<param name="flashvars" value="XMLPath=http://www.websector.de/blog/wp-content/uploads/2008/02/01/screenshots.xml&amp;langID=EN" />
	<param name="menu" value="false" />
	<param name="bgcolor" value="#FFFFFF" />
	<param name="allowscriptaccess" value="sameDomain" />
	<param name="allowfullscreen" value="true" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.websector.de/blog/wp-includes/swf/ws-slideshow.swf"
			name="fm_ws-slideshow_1425907062"
			width="500"
			height="400">
		<param name="flashvars" value="XMLPath=http://www.websector.de/blog/wp-content/uploads/2008/02/01/screenshots.xml&amp;langID=EN" />
		<param name="menu" value="false" />
		<param name="bgcolor" value="#FFFFFF" />
		<param name="allowscriptaccess" value="sameDomain" />
		<param name="allowfullscreen" value="true" />
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>&nbsp;</p>
</div>
<h2 id="download">Install now!</h2>
<p><!-- air badge --></p>
<div width="217" height="180">

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_AIRInstallBadge_1958224152"
			class="flashmovie"
			width="217"
			height="180">
	<param name="movie" value="http://www.websector.de/blog/wp-includes/swf/AIRInstallBadge.swf" />
	<param name="flashvars" value="airversion=1.1&amp;appname=WS-ThumbsGenerator&amp;appurl=http://www.websector.de/blog/download-manager.php?id=16&amp;appid=WS-ThumbsGenerator&amp;pubid=8C9D6A6C4DE1A2413839F81087EB2593CEE4D162.1&amp;appversion=0.1&amp;imageurl=http://www.websector.de/blog/wp-content/uploads/2008/02/01/air_ws_tg.jpg&amp;appinstallarg=installed from web&amp;applauncharg=launched from web&amp;hidehelp=false&amp;skiptransition=false&amp;titlecolor=#00AAFF&amp;buttonlabelcolor=#00AAFF&amp;appnamecolor=#00AAFF" />
	<param name="menu" value="false" />
	<param name="bgcolor" value="#000000" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.websector.de/blog/wp-includes/swf/AIRInstallBadge.swf"
			name="fm_AIRInstallBadge_1958224152"
			width="217"
			height="180">
		<param name="flashvars" value="airversion=1.1&amp;appname=WS-ThumbsGenerator&amp;appurl=http://www.websector.de/blog/download-manager.php?id=16&amp;appid=WS-ThumbsGenerator&amp;pubid=8C9D6A6C4DE1A2413839F81087EB2593CEE4D162.1&amp;appversion=0.1&amp;imageurl=http://www.websector.de/blog/wp-content/uploads/2008/02/01/air_ws_tg.jpg&amp;appinstallarg=installed from web&amp;applauncharg=launched from web&amp;hidehelp=false&amp;skiptransition=false&amp;titlecolor=#00AAFF&amp;buttonlabelcolor=#00AAFF&amp;appnamecolor=#00AAFF" />
		<param name="menu" value="false" />
		<param name="bgcolor" value="#000000" />
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>&nbsp;</p>
</div>
<h2>Downloads</h2>
<p>AIR file: <a href="http://www.websector.de/blog/?download=WS-ThumbsGenerator.air">WS-ThumbsGenerator.air</a> (Downloads: 1161)<br />
Full source: <a href="http://www.websector.de/blog/?download=WS-ThumbsGenerator.zip">WS-ThumbsGenerator.zip</a> (Downloads: 984) </p>
<p>Files are open source and licensed under the <a href="http://www.mozilla.org/MPL/MPL-1.1.html">Mozilla Public License 1.1.</a> </p>
<p>Have fun! <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>-Jens</p>
]]></content:encoded>
			<wfw:commentRss>http://www.websector.de/blog/2008/02/01/ws-thumbsgenerator-using-the-drag-and-drop-and-file-system-apis-with-adobes-jpegencoder-to-create-image-thumbnails/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>10 tips for working with PureMVC</title>
		<link>http://www.websector.de/blog/2007/12/25/10-tips-for-working-with-puremvc/</link>
		<comments>http://www.websector.de/blog/2007/12/25/10-tips-for-working-with-puremvc/#comments</comments>
		<pubDate>Tue, 25 Dec 2007 07:40:00 +0000</pubDate>
		<dc:creator>sectore</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PureMVC]]></category>

		<guid isPermaLink="false">http://www.websector.de/blog/2007/12/26/10-tips-for-working-with-puremvc/</guid>
		<description><![CDATA[This post is translated into German, Russian, Chinese and French. Thanks a lot to Aleksey, duzengqiang and Eric for the translations! Jesse Wardens great article called &#8220;10 Tips For Working With Cairngorm&#8221; has given me the idea to share 10 tips using PureMVC as well. I&#8217;ve been using PureMVC intensively for about six months now [...]]]></description>
			<content:encoded><![CDATA[<p style="background-color: #f6f6f6"><strong>This post is translated into <a href="http://www.flexughh.de/2007/12/27/10-tips-fur-das-arbeiten-mit-puremvc/">German</a>,    <a href="http://injun.ru/?p=425">Russian</a>, <a href="http://www.duzengqiang.com/blog/article.asp?id=674">Chinese</a> and <a href="http://www.polemedia.com/puremvc/10trucs.htm">French</a>.</strong> Thanks a lot to <a href="http://injun.ru/?author=1">Aleksey</a>, <a href="http://www.duzengqiang.com">duzengqiang</a> and <a href="http://www.videotron.com/">Eric</a> for the translations!</p>
<p><a href="http://www.jessewarden.com/">Jesse Wardens</a> great article called <a href="http://www.jessewarden.com/2007/08/10-tips-for-working-with-cairngorm.html">&#8220;10 Tips For Working With Cairngorm&#8221;</a> has given me the idea to share 10 tips using <a href="http://www.puremvc.org">PureMVC</a> as well. I&#8217;ve been using PureMVC intensively for about six months now and &#8211; that&#8217;s not a secret &#8211; I&#8217;m loving it. Anyway, all my following opinions are based on my personal experiences only. <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><span id="more-42"></span></p>
<ol>
<li>
<h2>Think in (Pure)MVC</h2>
<p>How do I start using PureMVC? Short answer: Just think in (Pure)MVC! As its named says, PureMVC based on the classic <a href="http://en.wikipedia.org/wiki/Model-view-controller">Model-View-Controller</a> design meta-pattern. Using the <a href="http://en.wikipedia.org/wiki/Fa%C3%A7ade_pattern">Facade-pattern</a> you don&#8217;t instantiate the core actors directly, but every member of PureMVC has its own and clear defined role:<br />
- Proxies = Model</p>
<p>- Mediator and its ViewComponents = View<br />
- Commands = Controller</li>
<li>
<h2>Create an API for View Components</h2>
<p>A View Component might be a standard UI component (e.g. <code>DataGrid</code>) or a custom component (e.g. a world within a game) or whatever. Don&#8217;t use its public methods directly. In order to change its state or behavior create an API.</p>
<p>One of the advantage of PureMVC is to be neutral to the technologies being used. An example: I&#8217;ve built a &#8220;pure&#8221; Flash application based on PureMVC without using the Flex Framework. The same app will be ported to an AIR application for using AIR&#8217;s great File system API. The View Components have to be changed using the Flex Framework, but not the Mediators or any other actors of PureMVC.</li>
<li>
<h2>Use one Mediator for multiple View Components</h2>
<p>To coordinate more than one View Component closely, use one Mediator only. In other words: Not all Views need a Mediator. For example: Assume a <code>ApplicationControlBar</code>  containing a <code>TextInput </code>, and a <code>Button</code> or something else. Then create just one Mediator for the <code>ApplicationControlBar</code> called <code>ApplicationControlBarMediator</code> and refer to the missing components casted as a second, third, etc. View Component.</li>
<li>
<h2>Let&#8217;s Events bubble up</h2>
<p>What happens if you don&#8217;t want to use multiple View Components within a Mediator? In order to handle user interactions with multiple View Components let&#8217;s bubble Events from the nested children of a View Component up.</p>
<p>For example: Clicking any Button within a View Component will fired up a custom Event which the Mediator is listen to. So the Mediator don&#8217;t have to know about the existing Button or about any other child of its View Component, just about the custom Event bubbled up.</li>
<li>
<h2>Communicate using Notifications as often as possible</h2>
<p>Notifications are the “Events” of PureMVC. For communicating between the three tiers Model, View and Controller use Notifications for the following scenarios as often as possible:</p>
<p>(communication from -&gt; to)<br />
- Mediator -&gt; Proxy (via mapped Commands)<br />
- Proxy -&gt; Mediator<br />
- Proxy -&gt; Command<br />
- Commands -&gt; Mediator</p>
<p>Even if it&#8217;s possible to retrieve a Proxy from a Mediator, don&#8217;t change the Proxy from a Mediator directly rather than sending a Notification using a mapped Command. It&#8217;s a bad practice to change a Proxy (Model) from a Mediator (View) directly without using a Command (Controller).</li>
<li>
<h2>Use Commands / MacroCommands as often as possible</h2>
<p>Commands are doing the job at the Controller side: Retrieving and interacting Proxies, communicating with Mediators or executing other Commands. Even if a Command used only once or it has only two lines of code, use it as often as possible. To execute a Command once again anywhere or anytime within your application, you have to send just a Notification. In the future it&#8217;s easy to enlarge the Command with more complex actions. And &#8211; that&#8217;s very important &#8211; you always know, who the actor for changing the Proxy (Model) is.</p>
<p>Question: Have you had to execute more than one Command in a particular order? Use MacroCommands to execute multiple SubCommands (which means &#8220;simple&#8221; Commands) sequentially.</li>
<li>
<h2>Use Remote Proxy to send and receive server-side data</h2>
<p>To send and receive data between the application tier use Proxies called <code>Remote Proxies</code>. That&#8217;s not a special kind of a PureMVC <code>Proxy</code>, just a location based on a <code>Proxy</code> to organize the server calls such as <code>HTTPServices</code>, <code>RemoteObjects</code> or whatever.</p>
<p>For example: To call a server-side <code>RemoteObject</code> to login a user create Proxy called <code>LoginProxy</code>. The <code>LoginProxy</code> does all the job to communicate with the server-side, which means sending and receiving data. Whenever you&#8217;ll change the server-side implementation for the LoginProcess, you&#8217;ll have to change one location within your application only &#8211; the <code>LoginProxy</code>.</li>
<li>
<h2>Remove unused Mediators</h2>
<p>In some cases you don&#8217;t use a Mediator and its View Components anymore. Then remove the Mediator using <code>facade.removeMediator(MyMediator.NAME);</code> in conjunction with a self created <code>destroy()</code> method to remove the ViewComponent including all listeners, timer, references, etc. for a successful <a href="http://www.adobe.com/devnet/flashplayer/articles/garbage_collection.html">garbage collection</a>.</li>
<li>
<h2>The Power of VO&#8217;s (Value Objects)</h2>
<p>The place to store data within the Model are the Proxies &#8211; that&#8217;s right. The View Components have no need to know the Facade and the rest of the PureMVC application &#8211; that&#8217;s right, too. This means that the View Component has no access to the Model data directly.</p>
<p>To avoid this issue store within the View Component a reference to the data using <a href="http://home.earthlink.net/~huston2/j2ee/corepatterns.html#valueobject">Value Objects</a> (VO&#8217;s). The VO&#8217;s are not a core actor of PureMVC and in conjunction with the Data Binding feature of Flex are a powerful way to react changes in the Model data without breaking rules.</li>
<li>
<h2>Courseware available</h2>
</li>
<p><a href="http://content.futurescale.com/">Cliff Hall</a> has done an awesome job: You&#8217;ll find not only excellent documentations about the &#8220;<a href="http://puremvc.org/component/option,com_wrapper/Itemid,35/">Framework Overview</a>&#8220;, &#8220;<a href="http://puremvc.org/component/option,com_wrapper/Itemid,30/">Best Practices</a>&#8221; and a &#8220;<a href="http://puremvc.org/component/option,com_wrapper/Itemid,34/">Conceptual Diagram</a>&#8220;, <strike>also a very, very, very helpful <a href="http://puremvc.org/component/option,com_wrapper/Itemid,139/">Courseware</a></strike>. Check it out!</ol>
<p>Enjoy PureMVC and Happy Holidays <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.websector.de/blog/2007/12/25/10-tips-for-working-with-puremvc/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>AsUnit (AS3): RemoteTestCase for testing asynchronous data using Flash Remoting</title>
		<link>http://www.websector.de/blog/2007/11/29/asunit-as3-remotetestcase-for-testing-asynchronous-data-using-flash-remoting/</link>
		<comments>http://www.websector.de/blog/2007/11/29/asunit-as3-remotetestcase-for-testing-asynchronous-data-using-flash-remoting/#comments</comments>
		<pubDate>Thu, 29 Nov 2007 13:09:00 +0000</pubDate>
		<dc:creator>sectore</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.websector.de/blog/2007/11/29/asunit-as3-remotetestcase-for-testing-asynchronous-data-using-flash-remoting/</guid>
		<description><![CDATA[UPDATE 12/05/07: Luke Bayes has added the RemotingTestCase to AsUnits repository. Thanks Luke! AsUnit is the first choice for Test-Driven Development using pure Flash applications. However, currently you find only one test case for asynchronous data using an instance of the flash.net.URLLoader class, but it seems neither for calling methods based on Flash Remoting using [...]]]></description>
			<content:encoded><![CDATA[<p style="background-color:#F6F6F6;"><strong>UPDATE 12/05/07:</strong> <a href="http://www.asserttrue.com/">Luke Bayes</a> has added the <code>RemotingTestCase</code> to <a href="http://asunit.svn.sourceforge.net/viewvc/asunit/">AsUnits repository</a>. Thanks Luke!</p>
<p><a href="http://www.asunit.org/">AsUnit</a> is the first choice for <a href="http://en.wikipedia.org/wiki/Test-driven_development">Test-Driven Development</a> using pure Flash applications. However, currently you find only one test case for asynchronous data using an instance of the <code>flash.net.URLLoader</code> class, but it seems neither for calling methods based on <a href="http://www.adobe.com/products/flashremoting/">Flash Remoting</a> using the <code>flash.net.NetConnection</code> class. So I decided to add a new test case called <code>asunit.framework.RemotingTestCase</code>&#8221; to the AsUnit Framework and hope it would be helpful for the community &#8211; check it out <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><span id="more-41"></span></p>
<h2>Examples</h2>
<p>Successfully asynchronous tests</p>
<p><img src="http://www.websector.de/blog/wp-content/uploads/2007/11/29/AsUnitTestSuccessfull.png" width="500" height="300" />
<p>Unsuccessfully asynchronous tests</p>
<p><img src="http://www.websector.de/blog/wp-content/uploads/2007/11/29/AsUnitTestUnSuccessfull.png" width="500" height="300" /><br />
<h2>Source</h2>
<p>For more information check out the comments within the code, too <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<div class="codeHeadlineBox">
<p>asunit.framework.RemotingTestCase ( <a href="http://www.websector.de/blog/wp-content/uploads/2007/11/29/RemotingTestCase.as">Download code</a> )</p>
</div>
<div class="actionscript" style="font-family: monospace;">
<ol>
<li class="li1">
<div class="de1">package asunit.<span class="me1">framework</span> </div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">import</span> flash.<span class="me1">errors</span>.<span class="me1">IllegalOperationError</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">import</span> flash.<span class="me1">events</span>.<span class="me1">IOErrorEvent</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">import</span> flash.<span class="me1">events</span>.<span class="me1">NetStatusEvent</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">import</span> flash.<span class="me1">events</span>.<span class="me1">SecurityErrorEvent</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">import</span> flash.<span class="me1">net</span>.<span class="kw3">NetConnection</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">import</span> flash.<span class="me1">net</span>.<span class="me1">ObjectEncoding</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">import</span> flash.<span class="me1">net</span>.<span class="me1">Responder</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">import</span> asunit.<span class="me1">framework</span>.<span class="me1">TestCase</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">import</span> asunit.<span class="me1">util</span>.<span class="me1">ArrayIterator</span>;&nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp;&nbsp; * RemotingTestCase </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp;&nbsp; * @author &nbsp;Jens Krause [www.websector.de]</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp;&nbsp; * @date &nbsp; &nbsp;11/29/07</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp;&nbsp; * </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp;&nbsp; */</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">class</span> RemotingTestCase <span class="kw3">extends</span> TestCase </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; protected <span class="kw2">var</span> connection: <span class="kw3">NetConnection</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * Constructor</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * @param testMethod&nbsp;&nbsp;String&nbsp; &nbsp;&nbsp; &nbsp;Name of the test case</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; */</span>&nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> RemotingTestCase<span class="br0">&#40;</span>testMethod: <span class="kw3">String</span> = <span class="kw2">null</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">super</span><span class="br0">&#40;</span>testMethod<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * Inits a netConnection instance and add all necessary event listeners</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; */</span>&nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; protected <span class="kw2">function</span> initConnection<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>connection == <span class="kw2">null</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connection = <span class="kw2">new</span> <span class="kw3">NetConnection</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connection.<span class="me1">addEventListener</span><span class="br0">&#40;</span>NetStatusEvent.<span class="me1">NET_STATUS</span>, connectionStatusHandler<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connection.<span class="me1">addEventListener</span><span class="br0">&#40;</span>IOErrorEvent.<span class="me1">IO_ERROR</span>, connectionIOErrorHandler<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connection.<span class="me1">addEventListener</span><span class="br0">&#40;</span>SecurityErrorEvent.<span class="me1">SECURITY_ERROR</span> , connectionSecurityErrorHandler<span class="br0">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * Dispose the netConnection instance</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; */</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; protected <span class="kw2">function</span> disposeConnection<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>connection != <span class="kw2">null</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connection.<span class="me1">removeEventListener</span><span class="br0">&#40;</span>NetStatusEvent.<span class="me1">NET_STATUS</span>, connectionStatusHandler<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connection.<span class="me1">removeEventListener</span><span class="br0">&#40;</span>IOErrorEvent.<span class="me1">IO_ERROR</span>, connectionIOErrorHandler<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connection.<span class="me1">removeEventListener</span><span class="br0">&#40;</span>SecurityErrorEvent.<span class="me1">SECURITY_ERROR</span> , connectionSecurityErrorHandler<span class="br0">&#41;</span>;&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connection = <span class="kw2">null</span>;&nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * Callback handler for receiving SecurityErrorEvent</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * @param event&nbsp; &nbsp; SecurityErrorEvent</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; */</span>&nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; protected <span class="kw2">function</span> connectionSecurityErrorHandler<span class="br0">&#40;</span>event: SecurityErrorEvent<span class="br0">&#41;</span>: <span class="kw3">void</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result.<span class="me1">addError</span><span class="br0">&#40;</span><span class="kw3">this</span>, <span class="kw2">new</span> IllegalOperationError<span class="br0">&#40;</span>event.<span class="kw3">toString</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; isComplete = <span class="kw2">true</span>;&nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * Callback handler for receiving IOErrorEvent</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * @param event&nbsp; &nbsp; IOErrorEvent</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; */</span>&nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; protected <span class="kw2">function</span> connectionIOErrorHandler<span class="br0">&#40;</span>event: IOErrorEvent<span class="br0">&#41;</span>: <span class="kw3">void</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result.<span class="me1">addError</span><span class="br0">&#40;</span><span class="kw3">this</span>, <span class="kw2">new</span> IllegalOperationError<span class="br0">&#40;</span>event.<span class="kw3">toString</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; isComplete = <span class="kw2">true</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * Callback handler for receiving NetStatusEvent</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * @param event&nbsp; &nbsp; NetStatusEvent</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; */</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; protected <span class="kw2">function</span> connectionStatusHandler<span class="br0">&#40;</span>event: NetStatusEvent<span class="br0">&#41;</span>: <span class="kw3">void</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * Connects the gateway</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * @param $gateway&nbsp; &nbsp;&nbsp; &nbsp;String&nbsp;&nbsp;Remote gateway</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * @param $encoding&nbsp; &nbsp; uint&nbsp; &nbsp; Object encoding using either AMF0 or AMF3</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; */</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; protected <span class="kw2">function</span> <span class="kw3">connect</span> <span class="br0">&#40;</span>$gateway: <span class="kw3">String</span> = <span class="kw2">null</span>, $encoding: uint = <span class="nu0">0</span><span class="br0">&#41;</span>: <span class="kw3">void</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; initConnection<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;connection.<span class="me1">objectEncoding</span> = <span class="br0">&#40;</span>$encoding &gt; ObjectEncoding.<span class="me1">AMF0</span><span class="br0">&#41;</span> ? $encoding : ObjectEncoding.<span class="me1">AMF0</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;<span class="kw3">try</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;connection.<span class="kw3">connect</span><span class="br0">&#40;</span>$gateway<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;<span class="kw3">catch</span><span class="br0">&#40;</span><span class="kw3">error</span>: <span class="kw3">Error</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;result.<span class="me1">addError</span><span class="br0">&#40;</span><span class="kw3">this</span>, <span class="kw3">error</span><span class="br0">&#41;</span>;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * Calls a remote service method and test it </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * @param $method&nbsp; &nbsp; &nbsp; &nbsp; String&nbsp; &nbsp; Remote service</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * @param $responder&nbsp;&nbsp;Responder&nbsp; &nbsp; Responder to handle remoting calls</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * @param $arguments&nbsp;&nbsp;Array&nbsp; &nbsp; &nbsp; &nbsp; Rest paramaters (optional) </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; */</span>&nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; protected <span class="kw2">function</span> <span class="kw3">call</span> <span class="br0">&#40;</span>$method: <span class="kw3">String</span> = <span class="kw2">null</span>, $responder: Responder = <span class="kw2">null</span>, &#8230;$arguments<span class="br0">&#41;</span>: <span class="kw3">void</span>&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> hasReferenceError: <span class="kw3">Boolean</span> = <span class="kw2">false</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// parameters for calling connection.call();</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// To avoid using the type unsafe &#8230;rest operator I decided to use type safe parameters within RemotingTestCase.call() </span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// and apply these later to connection.call();</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> params: <span class="kw3">Array</span> = <span class="br0">&#91;</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// check remote method </span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>$method != <span class="kw2">null</span><span class="br0">&#41;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; params.<span class="kw3">push</span><span class="br0">&#40;</span>$method<span class="br0">&#41;</span>;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result.<span class="me1">addError</span><span class="br0">&#40;</span><span class="kw3">this</span>, <span class="kw2">new</span> ReferenceError<span class="br0">&#40;</span><span class="st0">&quot;RemotingTestCase.call() has to defined a remote method.&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hasReferenceError = <span class="kw2">true</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// check responder</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>$responder != <span class="kw2">null</span><span class="br0">&#41;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; params.<span class="kw3">push</span><span class="br0">&#40;</span>$responder<span class="br0">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result.<span class="me1">addError</span><span class="br0">&#40;</span><span class="kw3">this</span>, <span class="kw2">new</span> ReferenceError<span class="br0">&#40;</span><span class="st0">&quot;RemotingTestCase.call() has to defined a responder to handling its results.&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hasReferenceError = <span class="kw2">true</span>;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>&nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// In case of a reference error invoke test running instantly </span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// to show the errors created above and return</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>hasReferenceError<span class="br0">&#41;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">super</span>.<span class="me1">run</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> arrIterator: ArrayIterator = <span class="kw2">new</span> ArrayIterator<span class="br0">&#40;</span>$arguments<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">while</span> <span class="br0">&#40;</span>arrIterator.<span class="me1">hasNext</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; params.<span class="kw3">push</span><span class="br0">&#40;</span>arrIterator.<span class="me1">next</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;&nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>&nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// call remote service</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;<span class="kw3">try</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connection.<span class="kw3">call</span>.<span class="kw3">apply</span><span class="br0">&#40;</span><span class="kw2">null</span>, params<span class="br0">&#41;</span>;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;<span class="kw3">catch</span><span class="br0">&#40;</span><span class="kw3">error</span>: <span class="kw3">Error</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;result.<span class="me1">addError</span><span class="br0">&#40;</span><span class="kw3">this</span>, <span class="kw3">error</span><span class="br0">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>;&nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>The following test example based on my Flash Remoting example using <a href="http://www.openamf.com/">OpenAMF</a> described at the previous article called <a href="http://www.websector.de/blog/2007/09/23/best-practices-custom-class-mapping-using-openamf-and-as3-flash-cs3-not-flex/">&#8220;Best practices: Custom class mapping using OpenAMF and AS3 (Flash CS3 &#8211; not Flex)&#8221;</a></p>
<div class="codeHeadlineBox">
<p>RemotingTestCaseExample.as ( <a href="http://www.websector.de/blog/wp-content/uploads/2007/11/29/RemotingTestCaseExample.as">Download code</a> )</p>
</div>
<div class="actionscript" style="font-family: monospace;">
<ol>
<li class="li1">
<div class="de1">package tests</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">import</span> flash.<span class="me1">net</span>.<span class="me1">ObjectEncoding</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">import</span> flash.<span class="me1">net</span>.<span class="me1">Responder</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">import</span> asunit.<span class="me1">framework</span>.<span class="me1">RemotingTestCase</span>;&nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp;&nbsp; * RemotingTestCaseExample </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp;&nbsp; * @author &nbsp;Jens Krause [www.websector.de]</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp;&nbsp; * @date&nbsp; &nbsp; 11/29/97</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp;&nbsp; */</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">class</span> RemotingTestCaseExample <span class="kw3">extends</span> RemotingTestCase </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#123;</span>&nbsp; &nbsp;&nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">var</span> _result: <span class="kw3">Object</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">var</span> _userVO: UserVO;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * Constructor</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * @param testMethod&nbsp;&nbsp;String&nbsp; &nbsp;&nbsp; &nbsp;Name of the test case</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; */</span>&nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> RemotingTestCaseExample<span class="br0">&#40;</span>testMethod: <span class="kw3">String</span> = <span class="kw2">null</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">super</span><span class="br0">&#40;</span>testMethod<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * After a test is executed the tearDown method is called </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * and removed all references to test objects</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; */</span>&nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; override protected <span class="kw2">function</span> tearDown<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _userVO = <span class="kw2">null</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * Before a test is executed the setUp method is called </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * which instantiate all necessary test objects</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; */</span>&nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; override protected <span class="kw2">function</span> setUp<span class="br0">&#40;</span><span class="br0">&#41;</span>: <span class="kw3">void</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class="br0">&#123;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; _userVO = _result as UserVO;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class="br0">&#125;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * Runs the test</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; */</span>&nbsp;&nbsp; &nbsp;&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> override <span class="kw2">function</span> run<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UserVO.<span class="me1">register</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _result = <span class="kw2">new</span> <span class="kw3">Object</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> gateway: <span class="kw3">String</span> = <span class="st0">&quot;http://localhost:8080/mappingExample/gateway&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> encoding: uint = ObjectEncoding.<span class="me1">AMF0</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> method: <span class="kw3">String</span> = <span class="st0">&quot;de.websector.blog.openamf.mapping.services.UserServices.getUserByName&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> responder:Responder = <span class="kw2">new</span> Responder<span class="br0">&#40;</span>onResult, onFault<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">super</span>.<span class="kw3">connect</span><span class="br0">&#40;</span>gateway, encoding<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">super</span>.<span class="kw3">call</span><span class="br0">&#40;</span>method, responder, <span class="st0">&quot;Luke Skywalker&quot;</span><span class="br0">&#41;</span>;&nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * Callback handler for receiving a fault</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * @param $result&nbsp; &nbsp; &nbsp; &nbsp; Object</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; */</span>&nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onFault<span class="br0">&#40;</span>$result: <span class="kw3">Object</span><span class="br0">&#41;</span>:<span class="kw3">void</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result.<span class="me1">addError</span><span class="br0">&#40;</span><span class="kw3">this</span>, <span class="kw2">new</span> <span class="kw3">Error</span><span class="br0">&#40;</span>$result.<span class="kw3">toString</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// call super.run() to execute test methods</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">super</span>.<span class="me1">run</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * Callback handler for receiving a result</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * @param $result&nbsp; &nbsp; &nbsp; &nbsp; Object</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * </span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; */</span>&nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onResult<span class="br0">&#40;</span>$result: <span class="kw3">Object</span><span class="br0">&#41;</span>:<span class="kw3">void</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _result = $result;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">super</span>.<span class="me1">disposeConnection</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;&nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// call super.run() to execute test methods</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">super</span>.<span class="me1">run</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * Tests the userVO</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; */</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> testUserVO<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assertTrue<span class="br0">&#40;</span><span class="st0">&quot;result is instance of &quot;</span>, _result is UserVO<span class="br0">&#41;</span>;&nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * Tests the userName</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; */</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> testUserName<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span>&nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assertEquals<span class="br0">&#40;</span><span class="st0">&quot;UserName Luke Skywalker&quot;</span>, _userVO.<span class="me1">userName</span>, <span class="st0">&quot;Luke Skywalker&quot;</span><span class="br0">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>&nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; * Tests the registerDate</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp; &nbsp; */</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> testRegisterDate<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span>&nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assertTrue<span class="br0">&#40;</span><span class="st0">&quot;Register date &quot;</span>, _userVO.<span class="me1">registerDate</span> is <span class="kw3">Date</span><span class="br0">&#41;</span>;&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>&nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//&nbsp; &nbsp; </span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//&nbsp; &nbsp; /**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//&nbsp;&nbsp; &nbsp; * Test that is born to lose.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//&nbsp;&nbsp; &nbsp; */</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//&nbsp;&nbsp; &nbsp;public function testFail():void </span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//&nbsp; &nbsp; {</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//&nbsp;&nbsp; &nbsp;&nbsp;assertFalse(&quot;failing test&quot;, true);</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//&nbsp;&nbsp; &nbsp;}</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<h2>Download</h2>
<p>Source including test example files: <br /><a href="http://www.websector.de/blog/?download=RemotingTestCaseExample.zip">RemotingTestCaseExample.zip</a> (Downloads: 937)</p>
<p>Happy (asynchronous) testing! <img src='http://www.websector.de/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  </p>
<h2>Acknowledge</h2>
<ul>
<li><strong>[AS3]</strong> Jonathan Marston: <a href="http://marstonstudio.com/index.php/2007/07/28/asunit-testing-with-flash-cs3-and-actionscript-3/">asunit testing with flash cs3 and actionscript 3</a></li>
<li><strong>[AS2]</strong> Tim Beynart &#8211; FlashCodersNY: <a href="http://www.flashcodersny.org/wordpress/?p=103">ASUnit Step-By-Step: Part One</a></li>
<li><strong>[AS2]</strong> Tim Beynart &#8211; FlashCodersNY: <a href="http://www.flashcodersny.org/wordpress/?p=124">Unit testing for ActionScript 2.0, Part 2</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.websector.de/blog/2007/11/29/asunit-as3-remotetestcase-for-testing-asynchronous-data-using-flash-remoting/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

