<?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>blackcj.com &#187; Flash</title>
	<atom:link href="http://www.blackcj.com/blog/category/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blackcj.com/blog</link>
	<description>Cutting edge development with Adobe Flex, ActionScript and AIR</description>
	<lastBuildDate>Thu, 15 Dec 2011 01:01:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>FITC Amsterdam 2011</title>
		<link>http://www.blackcj.com/blog/2010/11/23/fitc-amsterdam-2011/</link>
		<comments>http://www.blackcj.com/blog/2010/11/23/fitc-amsterdam-2011/#comments</comments>
		<pubDate>Tue, 23 Nov 2010 16:57:00 +0000</pubDate>
		<dc:creator>Chris Black</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[FITC]]></category>

		<guid isPermaLink="false">http://www.blackcj.com/blog/?p=919</guid>
		<description><![CDATA[I&#8217;ve always heard good things about FITC Amsterdam and after attending FITC San Francisco, I had to add it to my list for next year. The speaker line up looks phenomenal with over 50 presentations during the 2 day / 2 night conference. Get inspired in one of the coolest cities around the world. Check [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always heard good things about FITC Amsterdam and after attending FITC San Francisco, I had to add it to my list for next year. The speaker line up looks phenomenal with over 50 presentations during the 2 day / 2 night conference. Get inspired in one of the coolest cities around the world. Check back for some live blogging during the event!</p>
<p><strong>March 8-9, 2011 Amsterdam, NL</strong></p>
<p><a href="http://www.fitc.ca/amsterdam"><img src="http://www.blackcj.com/blog/wp-content/uploads/2010/11/AM11_500x180.jpg" alt="FITC Amsterdam 2011" title="AM11_500x180" width="500" height="180" class="aligncenter size-full wp-image-920" /></a></p>
<p>2011 is nearly here, make sure to grab your <a href="http://www.fitc.ca/events/tickets/?event=115" target="_blank">early bird tickets</a> before they sell out! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.blackcj.com/blog/2010/11/23/fitc-amsterdam-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More Battery Testing with Flash for Mobile</title>
		<link>http://www.blackcj.com/blog/2010/09/18/comparing-flash-with-cava/</link>
		<comments>http://www.blackcj.com/blog/2010/09/18/comparing-flash-with-cava/#comments</comments>
		<pubDate>Sat, 18 Sep 2010 22:13:35 +0000</pubDate>
		<dc:creator>Chris Black</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Myth]]></category>

		<guid isPermaLink="false">http://www.blackcj.com/blog/?p=882</guid>
		<description><![CDATA[After additional testing, Flash 10.1 still consumes about half the battery of the HTML5 equivalent in the browser on the Nexus One. This time running for 30 minutes, instead of 10, the canvas demo consumed 12% battery and Flash 7%. Arguably this is only a 41.66% difference but you get the point. Want to reproduce [...]]]></description>
			<content:encoded><![CDATA[<p>After additional testing, Flash 10.1 still consumes about half the battery of the HTML5 equivalent in the browser on the Nexus One. This time running for 30 minutes, instead of 10, the canvas demo consumed 12% battery and Flash 7%. Arguably this is only a 41.66% difference but you get the point. Want to reproduce this test at home? Here are the steps that I went through:</p>
<p><strong>Procedure:</strong><br />
Navigate to the desired demo to test so it&#8217;s cached in the browser<br />
Close the web browser<br />
Turn off all radios and put the phone in airplane mode<br />
Set the brightness to manual and turn it all the way down<br />
Set the screen timeout to 30 minutes<br />
Charge Android to 92% power (or whatever baseline you&#8217;d like)<br />
Unplug from the power and open your web browser<br />
Leave it for 30 minutes<br />
Close the browser and observe the battery power level<br />
Repeat for other technology</p>
<p><strong>Demo used:</strong><br />
HTML5 (JavaScript):<br />
<a href="http://www.blackcj.com/blog/wp-content/jsdemos/BallBounce/">http://www.blackcj.com/blog/wp-content/jsdemos/BallBounce/</a></p>
<p>Flash (ActionScript):<br />
<a href="http://www.blackcj.com/blog/wp-content/swfs/BallBounce/">http://www.blackcj.com/blog/wp-content/swfs/BallBounce/</a></p>
<p><strong>Results:</strong><br />
<a href="http://www.blackcj.com/blog/wp-content/uploads/2010/09/graph5.png"><img src="http://www.blackcj.com/blog/wp-content/uploads/2010/09/graph5.png" alt="" title="Battery Consumption for Mobile Web" width="400" height="308" class="aligncenter size-full wp-image-888" /></a></p>
<p>Both of my 30 minutes tests started at 92% battery power. After 30 minutes running the canvas demo, the battery was drained to 80%. The same amount of time running the Flash demo landed at 85%.</p>
<p><strong>Conclusion:</strong><br />
After running both 10 and 30 minute tests with both technologies, I feel quite confident in the results. Flash is consuming significantly less battery and performing better (57FPS vs 40FPS, see <a href="http://www.blackcj.com/blog/2010/09/17/flash-outperforms-html5-on-mobile-devices/">previous post</a>). Keep in mind that with both of these technologies mobile browsers currently hijack multi-touch and mouse move. When coding interactive content for the mobile web there is a lot to consider but don&#8217;t assume that HTML5 canvas is the answer. I would expect better results once HTML5 has matured but my bet is that by that time Flash will be running even better. For the best performance use native applications for interactive content and keep the mobile web simple.</p>
<p><strong>Now what?</strong><br />
This is actually getting quite complicated. CSS3 transitions work great on iOS but not so hot on the Android. Canvas works good on the Android but kills battery. The iOS performs horribly right now with Canvas. Flash works great in the web on the Android but not at all on iOS. Of course, a picture is worth a thousand words:</p>
<p><a href="http://www.blackcj.com/blog/wp-content/uploads/2010/09/mobile.jpg"><img src="http://www.blackcj.com/blog/wp-content/uploads/2010/09/mobile.jpg" alt="" title="Mobile web comparison chart" width="500" height="360" class="aligncenter size-full wp-image-884" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blackcj.com/blog/2010/09/18/comparing-flash-with-cava/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Flash Outperforms HTML5 on Mobile Devices</title>
		<link>http://www.blackcj.com/blog/2010/09/17/flash-outperforms-html5-on-mobile-devices/</link>
		<comments>http://www.blackcj.com/blog/2010/09/17/flash-outperforms-html5-on-mobile-devices/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 18:30:28 +0000</pubDate>
		<dc:creator>Chris Black</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Myth]]></category>

		<guid isPermaLink="false">http://www.blackcj.com/blog/?p=867</guid>
		<description><![CDATA[***Another Update: I&#8217;ve created a new post with a more complex animation and have also included SVG into the mix: http://www.blackcj.com/blog/2010/09/22/canvas-flash-and-svg-mobile-comparison/ *** ***Update: I&#8217;m already three steps ahead of this article. I have already received / analyzed the optimized JS in a later post. Please read all four articles on this topic before replying or [...]]]></description>
			<content:encoded><![CDATA[<p>***Another Update: I&#8217;ve created a new post with a more complex animation and have also included SVG into the mix: <a href="http://www.blackcj.com/blog/2010/09/22/canvas-flash-and-svg-mobile-comparison/">http://www.blackcj.com/blog/2010/09/22/canvas-flash-and-svg-mobile-comparison/</a> ***</p>
<p>***Update: I&#8217;m already three steps ahead of this article. I have already received / analyzed the optimized JS in a later post. Please read all four articles on this topic before replying or your comment will be filtered. Thanks!***</p>
<p>Anybody notice a re-occurring theme here? Canvas performance on the new iPod Touch and iPhone 4G is laughable at 22FPS rendering simple animation. At least the Nexus One can muster up a decent 40FPS for basic canvas rendering. Flash Player 10.1 on the other hand, blows HTML5 out of the water running at 57FPS on the Nexus One! Let&#8217;s not forget to mention that HTML5 consumed TWICE the battery life as Flash for these tests on the Android. Unfortunately, Steve doesn&#8217;t want me to know the exact battery life on my iPod Touch so it wasn&#8217;t included in that part of the testing.</p>
<p>All of these test were done by benchmarking <strong><u>in browser</u></strong> performance. Native applications using AIR for Android yields even better performance but we&#8217;ll leave that for the day when HTML5 can export to an APK (native Android app).</p>
<p>Let&#8217;s take a peek at some live footage:<br />
<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/sFFax1oYyBE?fs=1&amp;hl=en_US&amp;rel=0&amp;color1=0x5d1719&amp;color2=0xcd311b"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/sFFax1oYyBE?fs=1&amp;hl=en_US&amp;rel=0&amp;color1=0x5d1719&amp;color2=0xcd311b" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p><strong>Frame rate comparison:</strong><br />
<a href="http://www.blackcj.com/blog/wp-content/uploads/2010/09/graph.png"><img src="http://www.blackcj.com/blog/wp-content/uploads/2010/09/graph.png" alt="" title="Flash vs. HTML5 Framerate for Mobile Devices" width="400" height="308" class="aligncenter size-full wp-image-868" /></a></p>
<p>Keep in mind Flash Player 10.1 is relatively new. If Flash had been included with the original iPhone, you would have hated it. The new version, however, kicks ass. Would love to see some hacked iPhone Flash benchmarks to fill in the missing pieces on the above graph. If the iOS can&#8217;t render a little ball, HTML5 is going to be a hard sell for iDevices.</p>
<p>Why do we need 57FPS? Most web content targets 30FPS.<del datetime="2010-09-17T21:10:58+00:00">The human eye really can&#8217;t differentiate after about 30FPS</del>. Well, this is a single object rendered on the screen. Add some game logic, additional balls maybe a graphic and you&#8217;ll quickly find the 24FPS on the iPod dip down below 15. Having extra CPU cycles to do other things allows developers to target 30FPS when building games and animations.</p>
<p><strong>Battery consumption after 10 minutes:</strong><br />
<a href="http://www.blackcj.com/blog/wp-content/uploads/2010/09/graph3.png"><img src="http://www.blackcj.com/blog/wp-content/uploads/2010/09/graph3.png" alt="" title="graph(3)" width="400" height="308" class="aligncenter size-full wp-image-873" /></a></p>
<p>***Addition: The graph above is in percentage of batter drained after 10 minutes of animation during airplane mode (no cell or internet traffic to get in the way). A bit more crude than the first graph but I really didn&#8217;t want to sit around all afternoon waiting for my battery to drain. I&#8217;ll try to post some more battery data soon. The most important note is that Flash didn&#8217;t consume more battery than HTML5, which was counter to my initial hypothesis.***</p>
<p>This graph explains itself. Canvas consumes more battery power than Flash. It&#8217;s amazing that Flash can render something at 57FPS in half the battery power than it takes canvas to run at 40FPS.</p>
<p><strong>Try it out:</strong><br />
HTML5 (JavaScript):<br />
<a href="http://www.blackcj.com/blog/wp-content/jsdemos/BallBounce/">http://www.blackcj.com/blog/wp-content/jsdemos/BallBounce/</a></p>
<p>Flash (ActionScript):<br />
<a href="http://www.blackcj.com/blog/wp-content/swfs/BallBounce/">http://www.blackcj.com/blog/wp-content/swfs/BallBounce/</a></p>
<p><strong>Conclusion:</strong><br />
HTML5 will sit side by side with Flash. Gradient fonts, drop shadows, basic video and simple transitions are probably better suited for HTML5. When it comes to rendering display objects, animation and digital rights management for video, it would be silly not to use Flash. But wait Chris, HTML5 performance is going to get better! I&#8217;ll believe it when I see it. Adobe continues to raise the bar and it will be an uphill battle to catch up.</p>
<p>Graphs created using this tool:<br />
<a href="http://nces.ed.gov/nceskids/createAgraph/" target="_blank">http://nces.ed.gov/nceskids/createAgraph/</a></p>
<p><em><strong>Afterthought:</strong><br />
I&#8217;m actually quite satisfied with the HTML5 canvas for Android. It will probably work for what I was planning to do. After the iOS exporter in CS5 failed to produce quality animation results, I was hoping for more from HTML5. Basically, I feel stuck having to code in Objective-C just to hit the iOS folks out there. This essentially ruined some of my plans for creating a game framework that runs Box2D cross platform. It basically made my purchase of an iPod Touch rather worthless. Unless Apple steps up I&#8217;m going to have to exclude iOS devices from my demos or re-code everything in a third language. The whole point is not to have to re-create the same code for every device in a different language.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blackcj.com/blog/2010/09/17/flash-outperforms-html5-on-mobile-devices/feed/</wfw:commentRss>
		<slash:comments>65</slash:comments>
		</item>
		<item>
		<title>Post to TwitPic from Flash / Flex</title>
		<link>http://www.blackcj.com/blog/2010/09/16/post-to-twitpic-from-flash-flex/</link>
		<comments>http://www.blackcj.com/blog/2010/09/16/post-to-twitpic-from-flash-flex/#comments</comments>
		<pubDate>Thu, 16 Sep 2010 22:05:43 +0000</pubDate>
		<dc:creator>Chris Black</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.blackcj.com/blog/?p=861</guid>
		<description><![CDATA[Problem: TwitPic has a restricted crossdomain.xml file preventing your Flash web applications from posting directly to the service. Solution: Create a simple PHP script to proxy the request through a server that you do have access to! Here is the code: PLAIN TEXT PHP: &#60;?php &#160; $post_tweet_url='http://twitpic.com/api/uploadAndPost'; &#160; $file=$_FILES&#91;'media'&#93;; &#160; $postfields = array&#40;&#41;; &#160; $postfields&#91;'username'&#93; [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong><br />
TwitPic has a restricted crossdomain.xml file preventing your Flash web applications from posting directly to the service.</p>
<p><strong>Solution:</strong><br />
Create a simple PHP script to proxy the request through a server that you do have access to!</p>
<p><strong>Here is the code:</strong></p>
<div class="igBar"><span id="lphp-2"><a href="#" onclick="javascript:showPlainTxt('php-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-2">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$post_tweet_url</span>=<span style="color:#FF0000;">'http://twitpic.com/api/uploadAndPost'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$file</span>=<span style="color:#0000FF;">$_FILES</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'media'</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$postfields</span> = <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$postfields</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'username'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'username'</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$postfields</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'password'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'password'</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$postfields</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'message'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'message'</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$postfields</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'media'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#FF0000;">"@$file[tmp_name]"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$curl</span> = curl_init<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; curl_setopt<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$curl</span>, CURLOPT_CONNECTTIMEOUT, <span style="color:#CC66CC;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; curl_setopt<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$curl</span>, CURLOPT_HEADER, <span style="color:#000000; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; curl_setopt<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$curl</span>, CURLOPT_RETURNTRANSFER, <span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; curl_setopt<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$curl</span>, CURLOPT_BINARYTRANSFER, <span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; curl_setopt<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$curl</span>, CURLOPT_URL, <span style="color:#0000FF;">$post_tweet_url</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; curl_setopt<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$curl</span>, CURLOPT_POST, <span style="color:#CC66CC;color:#800000;">3</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; curl_setopt<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$curl</span>, CURLOPT_POSTFIELDS, <span style="color:#0000FF;">$postfields</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$result</span> = curl_exec<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$curl</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; curl_close<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$curl</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <a href="http://www.php.net/header"><span style="color:#000066;">header</span></a> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"content-type: text/xml"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$result</span> ;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Just create a PHP file with the contents above and replace the post URL from my previous <a href="http://www.blackcj.com/blog/2008/11/20/post-to-twitpic-from-adobe-air/">example</a> with the path to this script.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blackcj.com/blog/2010/09/16/post-to-twitpic-from-flash-flex/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Define Popup Window Size in HTML Text</title>
		<link>http://www.blackcj.com/blog/2010/03/01/define-popup-window-size-in-html-text/</link>
		<comments>http://www.blackcj.com/blog/2010/03/01/define-popup-window-size-in-html-text/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 21:31:08 +0000</pubDate>
		<dc:creator>Chris Black</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Myth]]></category>
		<category><![CDATA[TextField]]></category>

		<guid isPermaLink="false">http://www.blackcj.com/blog/?p=709</guid>
		<description><![CDATA[Executing JavaScript in a Flash HTML TextField is both cool and a little scary. You can throw some inline JavaScript in your htmlText to dynamically specify a pop up window size when using target="_blank." This works in both ActionScript 2.0 and ActionScript 3.0. Pop up Window Example: Example of Inline Java Script (click on the [...]]]></description>
			<content:encoded><![CDATA[<p>Executing JavaScript in a Flash HTML TextField is both cool and a little scary. You can throw some inline JavaScript in your htmlText to dynamically specify a pop up window size when using target="_blank." This works in both ActionScript 2.0 and ActionScript 3.0.</p>
<p><h3>Pop up Window Example:</h3>
<p><script type="text/javascript">// <![CDATA[
 var flashvars = {}; var params = { bgcolor: "ffffff" }; swfobject.embedSWF("http://www.blackcj.com/blog/wp-content/swfs/InlineJavascript/AS3_popup_size.swf", "InlineJavaScript", "300", "100", "9.0.0", "flash/expressInstall.swf", flashvars, params);
// ]]&gt;</script></p>
<div id="InlineJavaScript">
<h1>Example of Inline Java Script</h1>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></div>
<p><em>(click on the link above to open a 200 x 300 pop up window)</em>
</p>
<div class="igBar"><span id="lactionscript-4"><a href="#" onclick="javascript:showPlainTxt('actionscript-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-4">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// myTextField is a dynamic text field instance on the stage</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> link:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">"http://www.blackcj.com/"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> jsText:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">"window.open('"</span> + link + <span style="color: #ff0000;">"','win','height=200,width=300,toolbar=no,scrollbars=yes'); void(0);"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">myTextField.<span style="color: #0066CC;">htmlText</span> = <span style="color: #ff0000;">"&lt;a href=<span style="color: #000099; font-weight: bold;">\"</span>javascript:"</span> + jsText + <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\"</span>&gt;&lt;u&gt;blackcj.com&lt;/u&gt;&lt;/a&gt;"</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Any JavaScript tag can be run this way. Try adding an alert right after the window.open script. Notice how they both execute. Yet another reason to ALWAYS validate your input fields when displaying htmlText. Nothing worse than somebody adding some inline JavaScript to your Flash form.</p>
<p>
<strong>Resources</strong><br />
<a href="http://www.webmasterworld.com/html/3429895.htm">http://www.webmasterworld.com/html/3429895.htm</a><br />
<a href="http://kb2.adobe.com/cps/141/tn_14192.html">http://kb2.adobe.com/cps/141/tn_14192.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blackcj.com/blog/2010/03/01/define-popup-window-size-in-html-text/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t Forget to Update Your Adobe Products</title>
		<link>http://www.blackcj.com/blog/2009/12/27/dont-forget-to-update-your-adobe-products/</link>
		<comments>http://www.blackcj.com/blog/2009/12/27/dont-forget-to-update-your-adobe-products/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 20:02:07 +0000</pubDate>
		<dc:creator>Chris Black</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Adobe Updater]]></category>
		<category><![CDATA[BitmapData]]></category>
		<category><![CDATA[CS4]]></category>

		<guid isPermaLink="false">http://www.blackcj.com/blog/?p=640</guid>
		<description><![CDATA[Is Flash CS4 crashing when you try to open an FLA? Are you pulling out your hair wondering why Flex 3 doesn't auto complete BitmapData? Adobe Updater may be the answer. Flash CS4 10.0.2 One of my co-workers called me over to troubleshoot when a folder full of FLAs were crashing Flash CS4 every time [...]]]></description>
			<content:encoded><![CDATA[<p>Is Flash CS4 crashing when you try to open an FLA? Are you pulling out your hair wondering why Flex 3 doesn't auto complete BitmapData? Adobe Updater may be the answer.</p>
<h3>Flash CS4 10.0.2</h3>
<p>One of my co-workers called me over to troubleshoot when a folder full of FLAs were crashing Flash CS4 every time he tried to open them. He had already tried a fresh install of the software and had all of the necessary fonts. So why did it crash? Well it turns out that Flash CS4 had a bug where it would crash when embedded fonts are used.</p>
<p>"FLA crash on open when fonts loaded." -<a href="http://blogs.adobe.com/rgalvan/2009/05/flash_cs4_update_now_available.html" target="_blank">Glavan on Flash</a> <em>(detailed list of what was fixed)</em></p>
<p>After running Adobe Updater everything worked great!</p>
<h3>Flex Builder 3.0.2</h3>
<p>How about Flex Builder? I recently installed Windows 7 with a fresh copy of Flex Builder 3 Professional. Unfortunately I pulled the install from one of my external hard drives and it was version 3.0.1 rather than 3.0.2. A major bug with version 3.0.1 using SDK 3.3 and higher is that BitmapData does not auto complete. After trying multiple versions of the SDK I finally found the <a href="https://bugs.adobe.com/jira/browse/FB-14007" target="_blank">bug report</a> on Adobe Bugs citing that the problem was fixed in version 3.0.2.</p>
<p>After running Adobe Updater everything worked great!</p>
<p>See the common theme here? I tend to disable most of the automatic software updates since they are usually very annoying. After my experiences over the past week I will be checking Adobe Updater much more frequently! <strong>Always update after a fresh install.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blackcj.com/blog/2009/12/27/dont-forget-to-update-your-adobe-products/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Build a Flash Game in Under 3KB</title>
		<link>http://www.blackcj.com/blog/2009/10/11/build-a-flash-game-in-under-kb/</link>
		<comments>http://www.blackcj.com/blog/2009/10/11/build-a-flash-game-in-under-kb/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 20:58:45 +0000</pubDate>
		<dc:creator>Chris Black</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Games]]></category>

		<guid isPermaLink="false">http://www.blackcj.com/blog/?p=554</guid>
		<description><![CDATA[Here are three Flash games each built in under 3KB and in less than 4 hours. They may not be Half Life 2 but they are entertaining! Try your luck at the racing game, platform game, and a space shooter that I like to call Little Ship vs. Space. Wait? Doesn't everybody have loads of [...]]]></description>
			<content:encoded><![CDATA[<p>Here are three Flash games each built in under 3KB and in less than 4 hours. They may not be Half Life 2 but they are entertaining! Try your luck at the racing game, platform game, and a space shooter that I like to call Little Ship vs. Space.</p>
<p>Wait? Doesn't everybody have loads of bandwidth? Why create a game so small? Well, because it's fun, a good preparation for the 4KB challenge and most importantly size != entertainment. You may spend weeks designing, architecting, and developing a game only to find out it's not fun. <a href="http://blog.iainlobb.com/2009/09/3-minute-lesson-in-game-design-my-talk.html" target="_blank">Evolve your game</a>.</p>
<p>Build a 4KB game. If you enjoy playing it then slowly build it up into something better. Add levels, create graphics, improve the structure but AFTER you've come up with a cool idea. </p>
<p>Lets play some games! Don't forget to vote for your favorite game in the poll bellow the games.</p>
<h3>For all games click on the icon in the top right to re-start.</h3>
<p><strong>Racer Game (1.98KB):</strong><br />
<script type="text/javascript">// <![CDATA[
 var flashvars = {}; var params = { bgcolor: "ffffff" }; swfobject.embedSWF("http://www.blackcj.com/blog/wp-content/swfs/Games/Car.swf", "Car", "500", "400", "9.0.0", "flash/expressInstall.swf", flashvars, params);
// ]]&gt;</script></p>
<div id="Car">
<h1>Racing Game</h1>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></div>
<p><em>(Use the Left, Right, and Up arrows to move. Try and beat 20 seconds!)</em></p>
<p>Full source for the Racer game: <a href="http://www.blackcj.com/blog/wp-content/swfs/Games/Car.zip">zip</a> (2.09KB)</p>
<p><strong>Coin Collector (2.08KB):</strong><br />
<script type="text/javascript">// <![CDATA[
 var flashvars = {}; var params = { bgcolor: "ffffff" }; swfobject.embedSWF("http://www.blackcj.com/blog/wp-content/swfs/Games/Dude.swf", "Dude", "500", "400", "9.0.0", "flash/expressInstall.swf", flashvars, params);
// ]]&gt;</script></p>
<div id="Dude">
<h1>Coin Collector</h1>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></div>
<p><em>(Use the Left, Right, and Up arrows to move. Try and beat 16 seconds!)</em></p>
<p><strong>Space Shooter (2.99KB):</strong><br />
<span style="color: #ff0000;"><strong>Notice: MAC users have reported issues with the arrow keys in the Space Shooter game. I will look into this shortly and post a new, functional, version. Looks like I need a MAC to test on <img src='http://www.blackcj.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </strong></span><br />
<script type="text/javascript">// <![CDATA[
 var flashvars = {}; var params = { bgcolor: "000000" }; swfobject.embedSWF("http://www.blackcj.com/blog/wp-content/swfs/Games/LSS.swf", "LSS", "500", "400", "9.0.0", "flash/expressInstall.swf", flashvars, params);
// ]]&gt;</script></p>
<div id="LSS">
<h1>Space Shooter</h1>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></div>
<p><em>(Use the Left, Right, and Up arrows to move. Ctrl (Command) to fire. Try to get more than 4 frags!)</em></p>
<p></p>
<p><strong>How to do it:</strong><br />
After rudimentary tests Flash CS3 is the best enviornment to compile with. A pure AS3 project in Flex and a project built from CS4 add 500 bytes of overhead (Anyone know why? Maybe meta data?). You also save space by using an external AS file, so create a main.as file for your code. Put all of your code in this one file! Every additional AS file adds space rather than saves. Once your game is setup if you absolutely need one or two extra AS files than make them. Type all of your functions and variables. You'd think it would be the opposite but typed vars take up less space in the compiled SWF. Don't use MouseEvent.CLICK, use "click" to save some bytes.</p>
<p>Now for the game play.  </p>
<p>All three games use the arrow keys as input. Individual key listeners / flags use way to much code!  What are the values for left, right and up arrows? 37, 39, and 38.  None of which are divisible by anything but themselves.  So... lets add one key listener and multiply our single key value by the code value. Up = 38, Up * Left = 1406. That means that key value % expected value == 0 than our key is down. This only works for key values that don't have common denominators, key codes 2 and 4 would not work.  Both 2 and 4 mod 4 would result in true.  Looking back you could also push these codes into an array and do an index check which would allow more flexibility... mod is more fun though.</p>
<div class="igBar"><span id="lactionscript-7"><a href="#" onclick="javascript:showPlainTxt('actionscript-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-7">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">MovieClip</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">KeyboardEvent</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> main <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> k:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;color:#800000;">1</span>; &nbsp;&nbsp;&nbsp;<span style="color: #808080; font-style: italic;">// Keyboard number</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> main<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"enterFrame"</span>, eF<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"keyDown"</span>, kD<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"keyUp"</span>, kU<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> eF<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>k%<span style="color: #cc66cc;color:#800000;">37</span> == <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'rotate object left'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>k%<span style="color: #cc66cc;color:#800000;">39</span> == <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'rotate object right'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>k%<span style="color: #cc66cc;color:#800000;">38</span> == <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'add velocity'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// remove veloicty</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> kD<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:KeyboardEvent<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>k%<span style="color: #0066CC;">e</span>.<span style="color: #006600;">keyCode</span> != <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; k *= <span style="color: #0066CC;">e</span>.<span style="color: #006600;">keyCode</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> kU<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:KeyboardEvent<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>k%<span style="color: #0066CC;">e</span>.<span style="color: #006600;">keyCode</span> == <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; k /= <span style="color: #0066CC;">e</span>.<span style="color: #006600;">keyCode</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Both the Coin Collector and the Racer game use bitmap hit detection which is very little code and very powerful. Bitmap hit detection looks a bit like this:</p>
<div class="igBar"><span id="lactionscript-8"><a href="#" onclick="javascript:showPlainTxt('actionscript-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-8">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* Constructor */</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Car BitmapData, built in the enter frame function</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sb = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">500</span>, <span style="color: #cc66cc;color:#800000;">400</span>, <span style="color: #000000; font-weight: bold;">true</span>, 0x00000000<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Track BitmapData, doesn't move / change so lets build it here</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">tb = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">500</span>, <span style="color: #cc66cc;color:#800000;">400</span>, <span style="color: #000000; font-weight: bold;">true</span>, 0x00000000<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">m = <span style="color: #000000; font-weight: bold;">new</span> Matrix<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">m.<span style="color: #006600;">tx</span> = t.<span style="color: #006600;">x</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">m.<span style="color: #006600;">ty</span> = t.<span style="color: #006600;">y</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">tb.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span>t, m<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/* Enterframe loop */</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// First see if bitmap hit detection is needed.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>s.<span style="color: #006600;">hitTestObject</span><span style="color: #66cc66;">&#40;</span>t<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Clear our car bitmap data object</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; sb.<span style="color: #006600;">fillRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Rectangle<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>,<span style="color: #cc66cc;color:#800000;">0</span>,<span style="color: #cc66cc;color:#800000;">500</span>, <span style="color: #cc66cc;color:#800000;">400</span><span style="color: #66cc66;">&#41;</span>, 0x00000000<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Create a matrix that defines the location and rotation of the car</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; m = <span style="color: #000000; font-weight: bold;">new</span> Matrix<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; m.<span style="color: #006600;">rotate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span>/<span style="color: #cc66cc;color:#800000;">180</span><span style="color: #66cc66;">&#41;</span> *s.<span style="color: #006600;">rotation</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; m.<span style="color: #006600;">tx</span> = s.<span style="color: #006600;">x</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; m.<span style="color: #006600;">ty</span> = s.<span style="color: #006600;">y</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Draw the car to our BitmapData using the matrix</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; sb.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span>s, m<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Do a hit detection with the track BitmapData</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>tb.<span style="color: #0066CC;">hitTest</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>,<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>, 0xFF, sb, <span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>,<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>, 0x11<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; v = <span style="color: #cc66cc;color:#800000;">1</span>.<span style="color: #cc66cc;color:#800000;">1</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The space game deals with circles so that code uses Trigonometry for hit detection. We'll save that for another day. I need to clean it up a bit for it to really make much sense. Stay tuned for more on games!</p>
<p>Full source for the Racer game: <a href="http://www.blackcj.com/blog/wp-content/swfs/Games/Car.zip">zip</a></p>
<h3>Q/A:</h3>
<p><strong>Why 3KB?</strong><br />
My initial goal was 4KB. I hoarded the KBs so much that they all ended up under 3KB. I suppose that means I should add more features / levels.</p>
<p><strong>Whats with the sudden interest in games?</strong><br />
I actually used to be big into making games back in the AS2 days about 4 years ago. I built out a six level space shooter, 8-ball, and 9-ball billiards. My game programming was shelved for four years until one of my co-workers sparked my interest by mentioning the 4KB challenge <img src='http://www.blackcj.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Can I have the source code for the other two games?</strong><br />
E-mail me with specific questions and I'll be happy to help. I built out the Coin Collector and space games using the Racer as a starting point. It wouldn't be fun if I gave away all the answers <img src='http://www.blackcj.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><strong>People who inspired me to make these games:</strong><br />
<a href="http://blog.iainlobb.com/" target="_blank">Iain Lobb</a><br />
<a href="http://www.gamepoetry.com/blog/2009/02/06/flash-4k-game-competition-prizes-and-rules/" target="_blank">Game Poetry</a><br />
<a href="http://michaelhillsinteractive.com/" target="_blank">Micheal Hills</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blackcj.com/blog/2009/10/11/build-a-flash-game-in-under-kb/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flash Your TV: the suspense is killing me</title>
		<link>http://www.blackcj.com/blog/2009/09/08/flash-your-tv-the-suspense-is-killing-me/</link>
		<comments>http://www.blackcj.com/blog/2009/09/08/flash-your-tv-the-suspense-is-killing-me/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 16:33:54 +0000</pubDate>
		<dc:creator>Chris Black</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Your TV]]></category>

		<guid isPermaLink="false">http://www.blackcj.com/blog/?p=519</guid>
		<description><![CDATA[A look at some press releases from January 2009. Wait... wasn't that 8 months ago? Both Intel and Broadcom both talk about releasing Flash Lite supported hardware first half of 2009. What happened?   Intel and Adobe to Extend Flash Platform to TVs Jan 5, 2009 "Intel plans to ship the first CE3100 with support [...]]]></description>
			<content:encoded><![CDATA[<p>A look at some press releases from January 2009. Wait... wasn't that 8 months ago? Both Intel and Broadcom both talk about releasing Flash Lite supported hardware first half of 2009. What happened?</p>
<p> </p>
<h3><a href="http://www.adobe.com/aboutadobe/pressroom/pressreleases/200901/010509IntelAdobePR.html" target="_blank">Intel and Adobe to Extend Flash Platform to TVs</a></h3>
<p><em>Jan 5, 2009</em></p>
<p>"Intel plans to ship the first CE3100 with support for an optimized implementation of Adobe Flash Lite before mid-2009."</p>
<p>"Adobe and Intel are also working together to bring an optimized implementation of Adobe® AIR™ technology to Intel's digital home platform in the future."</p>
<p> </p>
<h3><a href="http://www.broadcom.com/press/release.php?id=s357665" target="_blank">Collaboration Extends Flash Platform Ecosystem to Digital TVs and Set-Top Boxes</a></h3>
<p><em>Jan 06, 2009</em></p>
<p>"Broadcom DTV and STB platforms with integrated Adobe Flash support are expected to be available to manufacturers in the first half of 2009"</p>
<p>"With Adobe Flash Lite™ 3 software supported... TV viewers will be able to view Flash based content and applications from popular online providers and entertainment sites."</p>
<p> </p>
<h3>Analysis</h3>
<p>According to both of the press releases the hardware will launch with Flash Lite support. Event the latest version of Flash Lite (3.1) is still ActionScript 2.0 (<a href="http://www.adobe.com/products/flashlite/version/" target="_blank">Flash Lite Fact Sheet</a>). The jump from AS2 to AS3 is very significant. The support is built into the hardware which would suggest it will not be upgradable through a software update. Here are three plausible scenarios based on the information at hand:</p>
<p><strong>Scenario 1:</strong><br />
Hardware launches in the upcoming months with AS2 support. The hardware could all be rendered obsolete when AIR support comes out. </p>
<p><strong>Scenario 2:</strong><br />
The eight months of silence could be due to a realization that obsolete hardware is not an ideal solution. Why not wait until AIR support is ready? This is the one I'm hoping for.</p>
<p><strong>Scenario 3:</strong><br />
They may be taking the time to ensure the hardware can be upgraded. Keep in mind there is an actual physical chip in the hardware that would need to support both AS2 and AS3.</p>
<p> </p>
<h3>Conclusion</h3>
<p>Are there scenerios that I haven't outlined? Of course. The three above are my 'best guesses.' What can we expect from MAX 2009? Hopefully some awesome news about Flash for your TV!</p>
<p>Whether it launches in AS2 or AS3, Flash support for televisions will be very cool. You may want to brush up on your ActionScript 2 skills just in case <img src='http://www.blackcj.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><strong>*Disclaimer*</strong><br />
<em>While it should be obvious, this post is entirely speculation. Adobe has remained completely silent on the topic of Flash for your TV, if anything, a bit too silent. The goal of this post is to get people thinking about the topic so they are ready when the hardware is available.</em></p>
<p><strong>Resources</strong><br />
<a href="http://www.engadgethd.com/tag/ce+3100/" target="_blank">Engagethd</a><br />
<a href="http://www.broadcom.com/press/release.php?id=s357665" target="_blank">Broadcom - Press Release</a><br />
<a href="http://www.adobe.com/aboutadobe/pressroom/pressreleases/200901/010509IntelAdobePR.html">Adobe - Press Release</a><br />
<a href="http://nerdacumen.com/white-paper-adobe-flash-for-television/2009/08/26/" target="_blank">Nerd Acumen</a><br />
<a href="http://www.twitter.com/flashyourtv" target="_blank">Flash Your TV on Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blackcj.com/blog/2009/09/08/flash-your-tv-the-suspense-is-killing-me/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Compress Transparent PNGs with Flash</title>
		<link>http://www.blackcj.com/blog/2009/07/24/compress-transparent-pngs-with-flash/</link>
		<comments>http://www.blackcj.com/blog/2009/07/24/compress-transparent-pngs-with-flash/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 14:52:48 +0000</pubDate>
		<dc:creator>Chris Black</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Compression]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[Myth]]></category>

		<guid isPermaLink="false">http://www.blackcj.com/blog/?p=465</guid>
		<description><![CDATA[Do you use transparent PNGs in Flash, Flex or AIR? Want to cut your application file size in half? Problem: Embedding transparent PNGs dramatically increases the size of your Flash, Flex and AIR applications. Photoshop and Fireworks dot not have any compression available for transparent PNGs (that I am aware of). Solution: Import your PNGs [...]]]></description>
			<content:encoded><![CDATA[<p>Do you use transparent PNGs in Flash, Flex or AIR?  Want to cut your application file size in half?</p>
<p><strong>Problem:</strong><br />
Embedding transparent PNGs dramatically increases the size of your Flash, Flex and AIR applications.  Photoshop and Fireworks dot not have any compression available for <strong>transparent</strong> PNGs (that I am aware of).</p>
<p><strong>Solution:</strong><br />
Import your PNGs into Flash, give them a linkage id, and export the file as a SWF.  Make sure to set your compression level in the publish settings (default is 80%).  Using this method, I was able to cut the file size <strong>in half</strong> for a number of applications.</p>
<div class="igBar"><span id="lactionscript-13"><a href="#" onclick="javascript:showPlainTxt('actionscript-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-13">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">"/assets/images/images.swf#myImage"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> MyImage:<span style="color: #000000; font-weight: bold;">Class</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> myImage:Sprite = <span style="color: #000000; font-weight: bold;">new</span> MyImage<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> as Sprite; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>rather than...</p>
<div class="igBar"><span id="lactionscript-14"><a href="#" onclick="javascript:showPlainTxt('actionscript-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-14">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// Don't use this one <img src='http://www.blackcj.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">"/assets/images/myImage.png"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> MyImage:<span style="color: #000000; font-weight: bold;">Class</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> myImage:BitmapAsset = <span style="color: #000000; font-weight: bold;">new</span> MyImage<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> as BitmapAsset; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>It is also much easier to manage your external assets from a SWF.  Designers can set up a nice slice sheet using the stage in Flash.  Much easier than managing tons of small PNGs in folders everywhere.</p>
<h3>Image Manager</h3>
<p>In addition to using the SWF it can also be very useful to set up an ImageManager to serve out images to your application.  This prevents having to change code in multiple places to update the same image reference.</p>
<p>Image Manager Class:</p>
<div class="igBar"><span id="lactionscript-15"><a href="#" onclick="javascript:showPlainTxt('actionscript-15'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-15">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package com.<span style="color: #006600;">cb</span>.<span style="color: #006600;">utils</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ImageManager</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const MY_IMAGE_ID:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">"my_image_id"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">"/assets/images/images.swf#myImage"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> MyImage:<span style="color: #000000; font-weight: bold;">Class</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> getMovie<span style="color: #66cc66;">&#40;</span>id:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:Sprite</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> result:Sprite;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">switch</span><span style="color: #66cc66;">&#40;</span>id<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> MY_IMAGE_ID:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">default</span>:</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result = <span style="color: #000000; font-weight: bold;">new</span> MyImage<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> result;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>To access an image from the manager class just make this call:</p>
<div class="igBar"><span id="lactionscript-16"><a href="#" onclick="javascript:showPlainTxt('actionscript-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-16">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> myImage:BitmapAsset = ImageManager.<span style="color: #006600;">getImage</span><span style="color: #66cc66;">&#40;</span>ImageManager.<span style="color: #006600;">MY_IMAGE_ID</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>Importing PNGs into Flash</h3>
<p>And for those of you that need a refresher on importing PNGs into Flash and setting up linkage IDs:</p>
<div id="attachment_468" class="wp-caption alignnone" style="width: 443px"><img class="size-full wp-image-468" title="Step 1" src="http://www.blackcj.com/blog/wp-content/uploads/2009/07/step1.jpg" alt="File-&gt;Import-&gt;Import to Stage..." width="433" height="374" /><p class="wp-caption-text">File-&gt;Import-&gt;Import to Stage...</p></div>
<p>Right click on the image. Select 'Convert to Symbol'...</p>
<p><img src="http://www.blackcj.com/blog/wp-content/uploads/2009/07/step2.png" alt="Step 2" title="Step 2" width="345" height="396" class="alignnone size-full wp-image-546" /></p>
<p>Finally...</p>
<p><img src="http://www.blackcj.com/blog/wp-content/uploads/2009/07/step3.png" alt="Step 3" title="Step 3" width="433" height="540" class="alignnone size-full wp-image-545" /></p>
<p>Enjoy!</p>
<p><em>Disclaimer: It may be obvious but you must be using transparent PNGs in your app to see a decrease in file size <img src='http://www.blackcj.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />   Most of the apps I work on have lots of transparent PNGs!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blackcj.com/blog/2009/07/24/compress-transparent-pngs-with-flash/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Re-Learning ActionScript 2</title>
		<link>http://www.blackcj.com/blog/2009/05/26/re-learning-actionscript-2/</link>
		<comments>http://www.blackcj.com/blog/2009/05/26/re-learning-actionscript-2/#comments</comments>
		<pubDate>Tue, 26 May 2009 17:51:53 +0000</pubDate>
		<dc:creator>Chris Black</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[ActionScript 2]]></category>
		<category><![CDATA[Delegate]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Singleton]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.blackcj.com/blog/?p=357</guid>
		<description><![CDATA[It's amazing how easy it is to forget the little niches in programming languages after going almost a year without using them. I recently had the pleasure of working on an ActionScript 2 project after almost a year of doing primarily ActionScript 3 development. This post will highlight a few things that can make ActionScript [...]]]></description>
			<content:encoded><![CDATA[<p>It's amazing how easy it is to forget the little niches in programming languages after going almost a year without using them.  I recently had the pleasure of working on an ActionScript 2 project after almost a year of doing primarily ActionScript 3 development.  This post will highlight a few things that can make ActionScript 2 development a bit more like 3.  I'll also provide links to resources that helped get me back in the mindset of AS2.</p>
<p><strong>Event dispatching.</strong><br />
One of the toughest parts of going back to AS2 is the event handling.  AS3 does this much better and one of my co-workers (<a href="http://twitter.com/rexeisen">@rexeisen</a>) sent me this great link: <a href="http://stackoverflow.com/questions/709107/best-practice-for-actionscript-2-events-is-there-a-way-to-simulate-actionscript">AS3 Style Events in AS2</a></p>
<p><strong>Singleton design pattern.</strong><br />
I found a great PDF outlining how to implement the singleton design pattern using AS2: <a href="http://www.playfool.com/patterns/singleton/Singleton.pdf">Singleton Design Patter with AS2</a></p>
<p>My singleton implementation:</p>
<div class="igBar"><span id="lactionscript-21"><a href="#" onclick="javascript:showPlainTxt('actionscript-21'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-21">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> com.<span style="color: #006600;">cb</span>.<span style="color: #006600;">Utils</span>.<span style="color: #006600;">messaging</span>.*;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> com.<span style="color: #006600;">cb</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">utils</span>.<span style="color: #006600;">Delegate</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> com.<span style="color: #006600;">sierrabravo</span>.<span style="color: #006600;">Utils</span>.<span style="color: #006600;">messaging</span>.<span style="color: #006600;">MessageManager</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> instance:MessageManager;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _container:<span style="color: #0066CC;">MovieClip</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _currentContent:<span style="color: #0066CC;">MovieClip</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _tint:<span style="color: #0066CC;">MovieClip</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> MessageManager<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Do nothing</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> getInstance<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:MessageManager</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>MessageManager.<span style="color: #006600;">instance</span> == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; MessageManager.<span style="color: #006600;">instance</span> = <span style="color: #000000; font-weight: bold;">new</span> MessageManager<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> MessageManager.<span style="color: #006600;">instance</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setParent<span style="color: #66cc66;">&#40;</span>parentClip:<span style="color: #0066CC;">MovieClip</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _container = parentClip;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> updatePosition<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>_currentContent<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _currentContent.<span style="color: #0066CC;">_x</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Stage</span>.<span style="color: #0066CC;">width</span> - _currentContent.<span style="color: #0066CC;">_width</span><span style="color: #66cc66;">&#41;</span> / <span style="color: #cc66cc;color:#800000;">2</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _currentContent.<span style="color: #0066CC;">_y</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Stage</span>.<span style="color: #0066CC;">height</span> - _currentContent.<span style="color: #0066CC;">_height</span><span style="color: #66cc66;">&#41;</span> / <span style="color: #cc66cc;color:#800000;">2</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>_tint<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _tint.<span style="color: #0066CC;">_width</span> = <span style="color: #0066CC;">Stage</span>.<span style="color: #0066CC;">width</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _tint.<span style="color: #0066CC;">_height</span> = <span style="color: #0066CC;">Stage</span>.<span style="color: #0066CC;">height</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> addMessageWindowContent<span style="color: #66cc66;">&#40;</span>contentWindow:MessageContentBase<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; tint<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _currentContent = _container.<span style="color: #0066CC;">createEmptyMovieClip</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">"content"</span>, _container.<span style="color: #0066CC;">getNextHighestDepth</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; contentWindow.<span style="color: #006600;">init</span><span style="color: #66cc66;">&#40;</span> _currentContent <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _currentContent.<span style="color: #0066CC;">_x</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Stage</span>.<span style="color: #0066CC;">width</span> - _currentContent.<span style="color: #0066CC;">_width</span><span style="color: #66cc66;">&#41;</span> / <span style="color: #cc66cc;color:#800000;">2</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _currentContent.<span style="color: #0066CC;">_y</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Stage</span>.<span style="color: #0066CC;">height</span> - _currentContent.<span style="color: #0066CC;">_height</span><span style="color: #66cc66;">&#41;</span> / <span style="color: #cc66cc;color:#800000;">2</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; contentWindow.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #0066CC;">CLOSE</span>, Delegate.<span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">this</span>, closeWindow <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> closeWindow<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'close window'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _currentContent.<span style="color: #0066CC;">removeMovieClip</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; clearTint<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> clearTint<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _tint.<span style="color: #0066CC;">removeMovieClip</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> tint<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _tint = _container.<span style="color: #0066CC;">createEmptyMovieClip</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"rectangles"</span>, _container.<span style="color: #0066CC;">getNextHighestDepth</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _tint.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0x000000, <span style="color: #cc66cc;color:#800000;">50</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _tint.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span>, 0x000033, <span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _tint.<span style="color: #0066CC;">moveTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _tint.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Stage</span>.<span style="color: #0066CC;">width</span>, <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _tint.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Stage</span>.<span style="color: #0066CC;">width</span>, <span style="color: #0066CC;">Stage</span>.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _tint.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #0066CC;">Stage</span>.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _tint.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _tint.<span style="color: #0066CC;">onRelease</span> = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//DO NOTHING</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _tint.<span style="color: #0066CC;">useHandCursor</span> = <span style="color: #000000; font-weight: bold;">false</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Preventing click through.</strong><br />
In the above example the screen is tinted to put focus on the pop up window.  Unfortunately, even though there is a movie clip on top of everything else, it does not prevent interaction with the elements layered below it.  In order to get around this I added an onRelease to the _tint movie clip along with a useHandCursor of false.  This prevents interaction with elements below the tint.  Here is the link to where I found this solution: <a href="http://codeblog.studiokoi.com/share/code/comments/disable_click_through_on_movieclips_in_flash/">Disable "Click-Through" on MovieClips in Flash</a></p>
<p><strong>Debugging in ActionScript 2.</strong><br />
For the project we were working on it was not possible to use the built in debugger for Flash.  Another great opportunity to use the Singleton design patter to include a trace window that can have text dumped out from any part of the application.</p>
<div class="igBar"><span id="lactionscript-22"><a href="#" onclick="javascript:showPlainTxt('actionscript-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-22">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">class</span> com.<span style="color: #006600;">cb</span>.<span style="color: #006600;">Utils</span>.<span style="color: #006600;">debug</span>.<span style="color: #006600;">Debugger</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> instance:Debugger;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _textField:<span style="color: #0066CC;">TextField</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _parentClip:<span style="color: #0066CC;">MovieClip</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> Debugger<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Do nothing</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> getInstance<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <img src='http://www.blackcj.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> ebugger</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>Debugger.<span style="color: #006600;">instance</span> == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; Debugger.<span style="color: #006600;">instance</span> = <span style="color: #000000; font-weight: bold;">new</span> Debugger<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> Debugger.<span style="color: #006600;">instance</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span>myText:<span style="color: #0066CC;">TextField</span>, parentClip:<span style="color: #0066CC;">MovieClip</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _textField = myText;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _textField.<span style="color: #0066CC;">wordWrap</span> = <span style="color: #000000; font-weight: bold;">true</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _textField.<span style="color: #0066CC;">background</span> = <span style="color: #000000; font-weight: bold;">true</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _textField.<span style="color: #0066CC;">border</span> = <span style="color: #000000; font-weight: bold;">true</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _textField.<span style="color: #0066CC;">multiline</span> = <span style="color: #000000; font-weight: bold;">true</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; _parentClip = parentClip;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> output<span style="color: #66cc66;">&#40;</span>myString:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>_textField<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;_textField.<span style="color: #0066CC;">swapDepths</span><span style="color: #66cc66;">&#40;</span>_parentClip.<span style="color: #0066CC;">getNextHighestDepth</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;_textField.<span style="color: #0066CC;">text</span> += myString + <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>XML parsing.</strong><br />
Parsing XML is a key part of AS2 and AS3.  I found a great tutorial on <a href="http://www.republicofcode.com/tutorials/flash/xml/">Loading XML data in Flash using ActionScript 2</a>.  This is my code for parsing XML.</p>
<div class="igBar"><span id="lactionscript-23"><a href="#" onclick="javascript:showPlainTxt('actionscript-23'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-23">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span>clip:<span style="color: #0066CC;">MovieClip</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; example_xml = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">XML</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; example_xml.<span style="color: #0066CC;">ignoreWhite</span> = <span style="color: #000000; font-weight: bold;">true</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; example_xml.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"xml/BookDefinition.xml"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; example_xml.<span style="color: #0066CC;">onLoad</span> = Delegate.<span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, onLoadEvent<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> onLoadEvent<span style="color: #66cc66;">&#40;</span>success:<span style="color: #0066CC;">Boolean</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>success<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> myImage = example_xml.<span style="color: #0066CC;">firstChild</span>.<span style="color: #0066CC;">firstChild</span>.<span style="color: #0066CC;">childNodes</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i = <span style="color: #cc66cc;color:#800000;">0</span>; i&lt;myImage.<span style="color: #0066CC;">length</span>; i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> pageNumber:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">parseInt</span><span style="color: #66cc66;">&#40;</span>myImage<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">childNodes</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">firstChild</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> imageURL:<span style="color: #0066CC;">String</span> = myImage<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">childNodes</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">firstChild</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> keywords:<span style="color: #0066CC;">String</span> = myImage<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">childNodes</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">firstChild</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">toLowerCase</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lxml-24"><a href="#" onclick="javascript:showPlainTxt('xml-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-24">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;book<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;pages<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;pageNumber<span style="font-weight: bold; color: black;">&gt;</span></span></span>1<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/pageNumber<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;pageFlash<span style="font-weight: bold; color: black;">&gt;</span></span></span>thumbnails/page01.jpg<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/pageFlash<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;pageText<span style="font-weight: bold; color: black;">&gt;</span></span></span>This is page 1.<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/pageText<span style="font-weight: bold; color: black;">&gt;</span></span></span>k</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/page<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;pageNumber<span style="font-weight: bold; color: black;">&gt;</span></span></span>2<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/pageNumber<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;pageImage<span style="font-weight: bold; color: black;">&gt;</span></span></span>thumbnails/page02.jpg<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/pageImage<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;pageText<span style="font-weight: bold; color: black;">&gt;</span></span></span>This is page 2.<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/pageText<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/page<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/pages<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/book<span style="font-weight: bold; color: black;">&gt;</span></span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Delegate functions.</strong><br />
Notice above that a delegate function was used to keep the scope of the function with the current class.  More information on delegate functions can be found here: <a href="http://www.actionscript.org/resources/articles/205/1/The-Delegate-Class/Page1.html">The Delegate Class</a></p>
<p>That's it for now.  I know that I'll be using this post as a reference the next time I have to jump on another AS2 project.  Being able to use design patterns, event dispatching, and debugging actually made coding in AS2 fun!  Enjoy.</p>
<p><strong>Additional resources.</strong><br />
<a href="http://www.flashmobileblog.com/tag/flash-lite-31/">http://www.flashmobileblog.com/tag/flash-lite-31/</a><br />
<a href="http://www.adobe.com/products/flashlite/features/">http://www.adobe.com/products/flashlite/features/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blackcj.com/blog/2009/05/26/re-learning-actionscript-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.335 seconds -->

