<?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>Nate Beck &#187; Flash</title>
	<atom:link href="http://blog.natebeck.net/tag/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.natebeck.net</link>
	<description>AIR, Flex / Flash, FMS, PushButton, Game... Developer</description>
	<lastBuildDate>Wed, 07 Sep 2011 21:24:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Developing games with PushButton Engine &#8211; Part 1 &#8211; Using Flex and Flash Builder</title>
		<link>http://blog.natebeck.net/2009/10/developing-games-with-pushbutton-engine-using-flex-and-flash-builder/</link>
		<comments>http://blog.natebeck.net/2009/10/developing-games-with-pushbutton-engine-using-flex-and-flash-builder/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 05:38:47 +0000</pubDate>
		<dc:creator>Nate Beck</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PushButton]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[games]]></category>

		<guid isPermaLink="false">http://blog.natebeck.net/?p=845</guid>
		<description><![CDATA[So I know I haven&#8217;t posted in quite some time. Between work, BugQuash, MAX, contributing to PushButton Engine, my country&#8217;s 500th anniversary to plan, my wedding to arrange, my wife to murder and Guilder to frame for it, I&#8217;ve been swamped. But tonight&#8230; I break my blog silence. As I just mentioned, I&#8217;ve been contributing]]></description>
			<content:encoded><![CDATA[<p>So I know I haven&#8217;t posted in quite some time.  Between work, BugQuash, MAX, contributing to PushButton Engine, my country&#8217;s 500th anniversary to plan, my wedding to arrange, my wife to murder and Guilder to frame for it, I&#8217;ve been swamped.</p>
<p>But tonight&#8230; I break my blog silence.  As I just mentioned, I&#8217;ve been contributing to the <a href="http://pushbuttonengine.com/" target="_blank">PushButton Flash Game Engine</a>.  I&#8217;m now going to show you how to set up Flex Builder 3 or Flash Builder 4 in a way that allows you to develop games on PushButton Engine, as well as how to work on the core engine itself.  I&#8217;m breaking this down into very small pieces so that everyone can follow along.  So it&#8217;s going to be a long post with lots of pretty pictures.</p>
<p>After writing this post, it ended up being longer than I hoped.  So I&#8217;m going to write a series of posts about developing games using PushButton Engine.  This post will focus only getting set up inside Flash and Flex Builder.  The plan is to add other IDEs in as well, for example FlashDevelop, FDT, etc&#8230;</p>
<h3>Step 1 : Download the PushButton Engine source code.</h3>
<p><b>[note]</b><br />
<i>If you are not familiar with Subversion or you need a primer to the basics of contributing to or working with open source projects please check out my <a href="http://blog.natebeck.net/2009/07/getting-dirty-with-the-flex-sdk-slides-and-recording/">&#8220;Getting Dirty with the Flex SDK&#8221;</a> post, more specifically the <a href="http://experts.na3.acrobat.com/p88453631/">TechWed Presentation</a>.</i><br />
<b>[/note]</b></p>
<h1><font color="#ff0000">WARNING!! For these steps to work, you must use at least revision 602 of the PushButton Engine.</font></h1>
</p>
<p>Download the PushButton Engine core from <a href="http://code.google.com/p/pushbuttonengine/source/checkout">Google Code</a>.  Since I am a developer in the engine, I have checked out trunk and all of the branches.  My working copy is located in /pbe (or C:/pbe on Windows). I will use that location throughout the rest of this post.  Make sure that if you choose a different location that you sub it in wherever I use &#8220;/pbe&#8221;.</p>
<p>So on OS X, to checkout the source code, open up Terminal and type in the following lines:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">svn</span> checkout http:<span style="color: #000000; font-weight: bold;">//</span>pushbuttonengine.googlecode.com<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span> pbe</pre></div></div>

<h3>Step 2 : Import the PBEngine Library project within Flex/Flash Builder.</h3>
<p>Open up Flex Builder (or Flash Builder), right click in the Flex Navigator and choose Import. (You can also use File > Import > Other).<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/001_import.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/001_import-300x225.png" alt="Import Project" title="Import Project" width="300" height="225" class="size-medium wp-image-847" /></a></p>
<p>Open up the &#8220;General&#8221; folder and choose &#8220;Existing Projects into Workspace&#8221; and click &#8220;Next&#8221;.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/002_existing.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/002_existing-288x300.png" alt="002_existing" title="002_existing" width="288" height="300" class="alignnone size-medium wp-image-848" /></a></p>
<p>Click the &#8220;Browse&#8221; button next to &#8220;Select root directory&#8221;.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/003_rootDir.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/003_rootDir-300x100.png" alt="003_rootDir" title="003_rootDir" width="300" height="100" class="alignnone size-medium wp-image-849" /></a></p>
<p>In revision 600 of the PushButton Engine I added &#8220;FB3&#8243; and &#8220;FB4&#8243; directories underneath &#8220;trunk/development&#8221;.  These directories have a Flex Library project skeleton within them that can be imported directly into Flex Builder.</p>
<p>If you are using Flex Builder 3, use the FB3 directory, and if you&#8217;re using Flash Builder 4, use the FB4 directory.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/004_selectFB3.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/004_selectFB3-300x184.png" alt="004_selectFB3" title="004_selectFB3" width="300" height="184" class="alignnone size-medium wp-image-850" /></a></p>
<p>Click Finish.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/005_selectedPBEngine.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/005_selectedPBEngine-287x300.png" alt="005_selectedPBEngine" title="005_selectedPBEngine" width="287" height="300" class="alignnone size-medium wp-image-851" /></a></p>
<p>You will see a Flex Library project in the Flex Navigator now.  You will also have an error, don&#8217;t worry, we&#8217;ll fix that in the next step.</p>
<h3>Step 3 : Setup the a Linked Resource for PBE</h3>
<p>So here is the error that you will see:<br />
<i>configuration variable &#8216;compiler.source-path&#8217; value contains unknown token &#8216;PBE&#8217;</i><br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/006_error.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/006_error-300x224.png" alt="006_error" title="006_error" width="300" height="224" class="alignnone size-medium wp-image-852" /></a></p>
<p>The project skeleton uses something called a &#8220;Linked Resource&#8221;, so that it can find the PushButton Engine source files.  To set this Linked Resource, you do the following:</p>
<p>Open up Flex Builder&#8217;s preferences.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/007_preferences.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/007_preferences-300x214.png" alt="007_preferences" title="007_preferences" width="300" height="214" class="alignnone size-medium wp-image-853" /></a></p>
<p>Under General > Workspace > Linked Resources&#8230; Click &#8220;New&#8230;&#8221;<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/008_linkedResources.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/008_linkedResources-300x246.png" alt="008_linkedResources" title="008_linkedResources" width="300" height="246" class="alignnone size-medium wp-image-854" /></a></p>
<p>Click on the &#8220;Folder&#8230;&#8221; button and navigate to the PushButton Engine &#8220;trunk&#8221; folder, &#8220;/pbe/trunk&#8221; (C:/pbe/trunk on Windows).<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/009_selectFolder.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/009_selectFolder-300x140.png" alt="009_selectFolder" title="009_selectFolder" width="300" height="140" class="alignnone size-medium wp-image-855" /></a></p>
<p>Hit &#8220;OK&#8221; and you should see PBE listed in the Linked Resources now.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/010_PBEResource.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/010_PBEResource-300x295.png" alt="010_PBEResource" title="010_PBEResource" width="300" height="295" class="alignnone size-medium wp-image-856" /></a></p>
<p>Clean the project to incorporate and rebuild all of the changes.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/011_cleanProject.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/011_cleanProject-300x208.png" alt="011_cleanProject" title="011_cleanProject" width="300" height="208" class="alignnone size-medium wp-image-857" /></a></p>
<p>If you see PBEngine.swc underneath the bin folder, you are good to go!  Nice work!<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/012_projectWSource.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/012_projectWSource-180x300.png" alt="012_projectWSource" title="012_projectWSource" width="180" height="300" class="alignnone size-medium wp-image-858" /></a></p>
<h2>:: UPDATE ::</h2>
<p>There have been file renames and other changes in the PushButton engine since this post.  If your SWC is failing to build do the following. </p>
<p>In the Flex Navigator, right click on the PBEngine Flex Library project.  Click Properties.  Go to &#8220;Flex Build Library Path&#8221;, under &#8220;Classes&#8221; uncheck [source path] src and recheck it.  If you are using Flash Builder 4, you can simply select &#8220;Include all classes from all source paths&#8221;.  Any other questions&#8230; post a comment and I&#8217;ll answer them.</p>
<h3>Step 4 : Create your game!</h3>
<p>For this example I&#8217;m going to create a VERY simple Hello World game to show that we have everything working correctly.</p>
<p>Right-click in Flex Navigator and choose &#8220;New&#8221; > &#8220;ActionScript Project&#8221;.</p>
<p>Give it a name of &#8220;HelloGame&#8221;, and click Finish.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/013_createASOnly.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/013_createASOnly-178x300.png" alt="013_createASOnly" title="013_createASOnly" width="178" height="300" class="alignnone size-medium wp-image-859" /></a></p>
<p>Now, to use the PBEngine Library within our HelloGame project, we need to create a link between the two.  </p>
<p>To do this, right click on the &#8220;HelloGame&#8221; project and choose &#8220;Properties&#8221;.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/014_helloProperties.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/014_helloProperties-175x300.png" alt="014_helloProperties" title="014_helloProperties" width="175" height="300" class="alignnone size-medium wp-image-860" /></a></p>
<p>Choose &#8220;ActionScript Build Path&#8221; from the list, and then click on &#8220;Add Project&#8230;&#8221;<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/015_AddProject.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/015_AddProject-300x269.png" alt="015_AddProject" title="015_AddProject" width="300" height="269" class="alignnone size-medium wp-image-861" /></a></p>
<p>You should see &#8220;PBEngine&#8221; in the list.</p>
<p>If you don&#8217;t see PBEngine, or you get a message that tells you, &#8220;There are no Flex Library projects in your workspace&#8221;, make sure that a) you have created a PBEngine Library by following the previous steps and b) the project is not closed.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/016_PBEngine.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/016_PBEngine-300x264.png" alt="016_PBEngine" title="016_PBEngine" width="300" height="264" class="alignnone size-medium wp-image-862" /></a></p>
<p>Select &#8220;PBEngine&#8221; and click &#8220;OK&#8221;.  You will now see PBEngine listed in the Build path libraries box.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/017_withLibrary.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/017_withLibrary-300x258.png" alt="017_withLibrary" title="017_withLibrary" width="300" height="258" class="alignnone size-medium wp-image-863" /></a></p>
<p>Now that the two projects are linked, you can start using classes right out of the PushButton Engine.  Code completion works, and everything compiles. Woot!<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/018_Intellisense.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/018_Intellisense-300x186.png" alt="018_Intellisense" title="018_Intellisense" width="300" height="186" class="alignnone size-medium wp-image-864" /></a></p>
<p>Great, now let&#8217;s write our impressive Hello World game.</p>
<p>Here is the source:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package <span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">pblabs</span>.<span style="color: #006600;">engine</span>.<span style="color: #006600;">PBE</span>;
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">pblabs</span>.<span style="color: #006600;">engine</span>.<span style="color: #006600;">debug</span>.<span style="color: #006600;">Logger</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> HelloGame <span style="color: #0066CC;">extends</span> Sprite
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> HelloGame<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			PBE.<span style="color: #006600;">startup</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;
			Logger.<span style="color: #0066CC;">print</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #ff0000;">&quot;Hello Nate!&quot;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Run or Debug the game.  At first you will see a blank screen, that is expected&#8230; Press the ~ (tilde or `) key, and the PushButton Console should come up.</p>
<p>The console has some commands by default: help, version, showFps and verbose (1 || 2)<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/10/020_console.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/10/020_console-300x213.png" alt="020_console" title="020_console" width="300" height="213" class="alignnone size-medium wp-image-866" /></a></p>
<p>You can add your own custom commands to the console to assist you while developing your games&#8230; but that is a post for another time.</p>
<p>Any questions, be sure to hit us up over on the <a href="http://pushbuttonengine.com/community/">PushButton Engine Forums</a> or in the freenode IRC channel: #pbengine.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.natebeck.net/2009/10/developing-games-with-pushbutton-engine-using-flex-and-flash-builder/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Tip of the Day &#8211; Using interactive assets from Flash in Flex</title>
		<link>http://blog.natebeck.net/2009/01/tip-of-the-day-using-interactive-assets-from-flash-in-flex/</link>
		<comments>http://blog.natebeck.net/2009/01/tip-of-the-day-using-interactive-assets-from-flash-in-flex/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 06:39:15 +0000</pubDate>
		<dc:creator>Nate Beck</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tip of the day]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.natebeck.net/?p=578</guid>
		<description><![CDATA[So for the most part... up to this point I haven't really needed to use extensive Flash animations within Flex.  I mean like most people, I've embedded swf assets into my Flex application by using the [Embed] metadata tag.  However, using the Embed metadata tag, in my opinion, is for static assets or simple animations... you know... images, animation only swfs, fonts, etc...

Today I found a cool button that I wanted to use in my Flex application.  
]]></description>
			<content:encoded><![CDATA[<p>So for the most part&#8230; up to this point I haven&#8217;t really needed to use extensive Flash animations within Flex.  I mean like most people, I&#8217;ve embedded swf assets into my Flex application by using the [Embed] metadata tag.  However, using the Embed metadata tag, in my opinion, is for static assets or simple animations&#8230; you know&#8230; images, animation only swfs, fonts, etc&#8230;</p>
<p>Today I found a cool button that I wanted to use in my Flex application.  </p>
<p>The button (roll your mouse over me):<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_exampleButton_372724959"
			class="flashmovie"
			width="50"
			height="50">
	<param name="movie" value="http://blog.natebeck.net/flash/experiments/exampleButton.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://blog.natebeck.net/flash/experiments/exampleButton.swf"
			name="fm_exampleButton_372724959"
			width="50"
			height="50">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>The thing about this button is that it has complex roll over and roll out animations.  Of course we could create the same thing within Flex using an ActionScript <a href="http://www.gskinner.com/libraries/gtween/" target="_blank">tween</a> class&#8230; but some things are better left to the Flash timeline.</p>
<p>So how do we get our button into Flex, with all of its animation and interactivity intact?  The answer, my friends, is to use Adobe&#8217;s Flex Component Kit.  </p>
<p>Doing some research online, it&#8217;s not really clear where to get it, or how to use it.  According to <a href="http://labs.adobe.com/wiki/index.php/Flex_Component_Kit_for_Flash_CS3" target="_blank">labs</a>, it&#8217;s released within Flex 3&#8230; but I don&#8217;t have a clue where.  So we&#8217;re going to do this my way&#8230;</p>
<h3>Step 1 : Install Adobe Extension Manager 2.1</h3>
<p><i>Obviously, you can skip this step if you already have Extension Manager 2.1 installed.</i></p>
<p>If you didn&#8217;t install the Adobe Extension Manager when you installed your copy of CS4, you can download it here &#8212;> <a href="http://www.adobe.com/exchange/em_download/" target="_blank">Download Adobe Extension Manager</a></p>
<p>If you already had Adobe Extension Manager installed&#8230; just be sure it has been updated to version 2.1.</p>
<p>Download and open up Setup.app<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/installfck_01.png" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/installfck_01-300x203.png" alt="installfck_01" title="installfck_01" width="300" height="203" class="alignnone size-medium wp-image-593" /></a></p>
<p>Click Next<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/installfck_02.png" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/installfck_02-300x196.png" alt="installfck_02" title="installfck_02" width="300" height="196" class="alignnone size-medium wp-image-594" /></a></p>
<p>Let it run<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/installfck_03.png" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/installfck_03-300x204.png" alt="installfck_03" title="installfck_03" width="300" height="204" class="alignnone size-medium wp-image-595" /></a></p>
<p>You&#8217;re welcome Adobe<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/installfck_05.png" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/installfck_05-300x206.png" alt="installfck_05" title="installfck_05" width="300" height="206" class="alignnone size-medium wp-image-596" /></a></p>
<p>Extension Manager &gt; About Extension Manager<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/installfck_06.png" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/installfck_06-300x226.png" alt="installfck_06" title="installfck_06" width="300" height="226" class="alignnone size-medium wp-image-597" /></a></p>
<p>Says 2.1&#8230; cool, we&#8217;re ready to move on to step 2.</p>
<h3>Step 2 : Install the Flex Component Kit</h3>
<p>Now we need to go download the extension &#8212;> <a href="http://www.adobe.com/go/flex_ck_en" target="_blank">Download the Flex Component Kit</a> (you need an adobe.com account)</p>
<p>All the way at the bottom you&#8217;ll find the extension we&#8217;re looking for&#8230; Flex Component Kit for Flash CS3 Professional (I know it says CS3 and we&#8217;re working in CS4, don&#8217;t worry)<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/installfck_07.png" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/installfck_07-300x81.png" alt="installfck_07" title="installfck_07" width="300" height="81" class="alignnone size-medium wp-image-598" /></a></p>
<p>Once downloaded, unzip and double-click FlexComponentKit.mxp<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/installfck_08.png" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/installfck_08-300x174.png" alt="installfck_08" title="installfck_08" width="300" height="174" class="alignnone size-medium wp-image-599" /></a></p>
<p>Read this whole agreement and <i>only</i> if you agree the terms click &#8220;Accept&#8221;<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/installfck_09.png" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/installfck_09-300x226.png" alt="installfck_09" title="installfck_09" width="300" height="226" class="alignnone size-medium wp-image-600" /></a><br />
&#8230;how many of you read that?</p>
<p>Okay, you should see this now.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/installfck_10.png" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/installfck_10-300x230.png" alt="installfck_10" title="installfck_10" width="300" height="230" class="alignnone size-medium wp-image-601" /></a></p>
<p>Documentation for this component can be found here &#8212;> <a href="http://livedocs.adobe.com/flex/3/flash_component_kit_flex3.pdf" target="_blank">FCK Docs</a></p>
<p>Onward!</p>
<h3>Step 3 : The Flash Side</h3>
<p>Let&#8217;s take our button and load it into Flash.  We&#8217;re going to name it &#8220;MyButton&#8221;.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/fck_part2_01.png" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/fck_part2_01-300x189.png" alt="fck_part2_01" title="fck_part2_01" width="300" height="189" class="alignnone size-medium wp-image-604" /></a></p>
<p>Create an AS3 class to handle all of the button interactions we need<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/fck_part2_02.png" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/fck_part2_02-300x189.png" alt="fck_part2_02" title="fck_part2_02" width="300" height="189" class="alignnone size-medium wp-image-605" /></a></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package <span style="color: #66cc66;">&#123;</span>
	<span style="color: #808080; font-style: italic;">// MyButton</span>
	<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">flash</span>.<span style="color: #006600;">UIMovieClip</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MyButton <span style="color: #0066CC;">extends</span> UIMovieClip
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> MyButton<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			buttonMode = <span style="color: #000000; font-weight: bold;">true</span>;
			<span style="color: #0066CC;">useHandCursor</span> = <span style="color: #000000; font-weight: bold;">true</span>;
&nbsp;
			addEventListener<span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_OVER</span>, onOver<span style="color: #66cc66;">&#41;</span>;
			addEventListener<span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_OUT</span>, onOut<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> onOver<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">gotoAndPlay</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> onOut<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">gotoAndPlay</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;end&quot;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Make sure you have MyButton selected in the Library, and then use Commands > Convert Symbol to Flex Component.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/fck_part2_03.png" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/fck_part2_03-300x194.png" alt="fck_part2_03" title="fck_part2_03" width="300" height="194" class="alignnone size-medium wp-image-606" /></a></p>
<p>Your output panel will let you know the command worked properly.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/fck_part2_04.png" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/fck_part2_04-300x78.png" alt="fck_part2_04" title="fck_part2_04" width="300" height="78" class="alignnone size-medium wp-image-607" /></a></p>
<p>Test the movie by pressing âŒ˜ + enter (ctrl + enter on the PC).<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/fck_part2_05.png" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/fck_part2_05-300x230.png" alt="fck_part2_05" title="fck_part2_05" width="300" height="230" class="alignnone size-medium wp-image-608" /></a></p>
<p>Publish the movie, which creates both a SWF and a SWC file.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/fck_part2_06.png" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/fck_part2_06-300x210.png" alt="fck_part2_06" title="fck_part2_06" width="300" height="210" class="alignnone size-medium wp-image-609" /></a></p>
<p>Now that we have our SWC file, we&#8217;re ready to move into Flex Builder.</p>
<h3>Step 4 : The Flex Side</h3>
<p>Copy our newly create SWC file into our libs directory.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/fck_part2_07.png" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/fck_part2_07.png" alt="fck_part2_07" title="fck_part2_07" width="217" height="148" class="alignnone size-full wp-image-610" /></a></p>
<p>With the SWC in our libs directory, it will automatically be included in the classpath of our Flex application (see <a href="http://blog.natebeck.net/2009/01/use-libs-directory-in-flex-builder/" target="_blank">this tip</a> for more information on the libs directory).</p>
<p>The SWC file includes the MyButton class, so we can now write our code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>?<span style="color: #0066CC;">xml</span> <span style="color: #0066CC;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;</span>mx:Application xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> 
	xmlns:local=<span style="color: #ff0000;">&quot;*&quot;</span> 
	layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> <span style="color: #0066CC;">backgroundColor</span>=<span style="color: #ff0000;">&quot;0x000000&quot;</span> backgroundGradientAlphas=<span style="color: #ff0000;">&quot;[0,0]&quot;</span> 
	creationComplete=<span style="color: #ff0000;">&quot;onReady()&quot;</span><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
			<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onReady<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #808080; font-style: italic;">// How to use the custom button in ActionScript </span>
				<span style="color: #808080; font-style: italic;">/*
				var button:MyButton = new MyButton();
				button.x = 35;
				button.y = -10;
&nbsp;
				addChild(button);
				*/</span>
&nbsp;
				<span style="color: #808080; font-style: italic;">// And just for fun				</span>
				makeGrid<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> makeGrid<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">var</span> pad:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">35</span>;
				<span style="color: #000000; font-weight: bold;">var</span> gridWidth:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">10</span>;
				<span style="color: #000000; font-weight: bold;">var</span> gridHeight:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">10</span>;
				<span style="color: #000000; font-weight: bold;">var</span> yOffset:<span style="color: #0066CC;">int</span> = -<span style="color: #cc66cc;">45</span>;
				<span style="color: #000000; font-weight: bold;">var</span> xOffset:<span style="color: #0066CC;">int</span> = -<span style="color: #cc66cc;">25</span>;
&nbsp;
				<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> h:<span style="color: #0066CC;">int</span>=<span style="color: #cc66cc;">1</span>; h<span style="color: #66cc66;">&lt;</span>=gridHeight; h++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
					<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> w:<span style="color: #0066CC;">int</span>=<span style="color: #cc66cc;">1</span>; w<span style="color: #66cc66;">&lt;</span>=gridWidth; w++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
						<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">button</span>:MyButton = <span style="color: #000000; font-weight: bold;">new</span> MyButton<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
						<span style="color: #0066CC;">button</span>.<span style="color: #006600;">x</span> = w<span style="color: #66cc66;">*</span>pad+xOffset;
						<span style="color: #0066CC;">button</span>.<span style="color: #006600;">y</span> = h<span style="color: #66cc66;">*</span>pad+yOffset;
						myPanel.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">button</span><span style="color: #66cc66;">&#41;</span>;
					<span style="color: #66cc66;">&#125;</span>
				<span style="color: #66cc66;">&#125;</span>
&nbsp;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;</span>mx:Panel id=<span style="color: #ff0000;">&quot;myPanel&quot;</span>
		layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> <span style="color: #0066CC;">left</span>=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #0066CC;">right</span>=<span style="color: #ff0000;">&quot;10&quot;</span> top=<span style="color: #ff0000;">&quot;10&quot;</span> bottom=<span style="color: #ff0000;">&quot;10&quot;</span> 
		<span style="color: #0066CC;">backgroundColor</span>=<span style="color: #ff0000;">&quot;#1D1D1D&quot;</span> title=<span style="color: #ff0000;">&quot;Hey look, I'm a Flex Panel&quot;</span><span style="color: #66cc66;">/&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;!</span>-- How to use the custom <span style="color: #0066CC;">button</span> <span style="color: #b1b100;">in</span> MXML --<span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;!</span>--<span style="color: #66cc66;">&lt;</span>local:MyButton x=<span style="color: #ff0000;">&quot;-5&quot;</span> y=<span style="color: #ff0000;">&quot;-10&quot;</span> <span style="color: #66cc66;">/&gt;</span>--<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;/</span>mx:Application<span style="color: #66cc66;">&gt;</span></pre></div></div>

<p>And here&#8217;s what it looks like:<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_test_FlashAsset_184343207"
			class="flashmovie"
			width="435"
			height="450">
	<param name="movie" value="http://blog.natebeck.net/flash/experiments/test_FlashAsset.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://blog.natebeck.net/flash/experiments/test_FlashAsset.swf"
			name="fm_test_FlashAsset_184343207"
			width="435"
			height="450">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Weeeeee&#8230;. that&#8217;s fun, you can download the <a href="http://blog.natebeck.net/flash/experiments/FlashAssetTest.zip" target="_blank">source here</a>.</p>
<p>The source there is an Archived Flex project, all you need to do is Import it into Flex Builder and you&#8217;re good to go.</p>
<p>That was a long tip, any questions please post them.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.natebeck.net/2009/01/tip-of-the-day-using-interactive-assets-from-flash-in-flex/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Tip of the Day &#8211; Tricks of the microphone settings panel</title>
		<link>http://blog.natebeck.net/2009/01/tip-of-the-day-tricks-of-the-mic-settings-panel/</link>
		<comments>http://blog.natebeck.net/2009/01/tip-of-the-day-tricks-of-the-mic-settings-panel/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 05:32:43 +0000</pubDate>
		<dc:creator>Nate Beck</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tip of the day]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.natebeck.net/?p=517</guid>
		<description><![CDATA[I have an extensive background using the Microphone class within Flash Player. Anytime you try to connect to a user&#8217;s microphone, Flash Player displays a privacy dialog box that alerts the user to choose whether to allow or deny access to the microphone. I&#8217;m sure you&#8217;ve seen it, this is what it looks like: You]]></description>
			<content:encoded><![CDATA[<p>I have an extensive background using the Microphone class within Flash Player. Anytime you try to connect to a user&#8217;s microphone, Flash Player displays a privacy dialog box that alerts the user to choose whether to allow or deny access to the microphone.</p>
<p>I&#8217;m sure you&#8217;ve seen it, this is what it looks like:<br />
<img src="http://blog.natebeck.net/wp-content/uploads/2009/01/micpermission.gif" alt="micpermission" title="micpermission" width="215" height="138" class="alignnone size-full wp-image-519" /></p>
<p>You widget (or app) MUST be a minimum of 216 x 138 (some people will argue you can do 215 wide, but in my testing sometimes 215 pixels wide can cause issues). When the player window is too small, the settings panel will either:</p>
<ol>
<li>Not show up at all, or</li>
<li>Show up clipped and in some browsers mouse events will not register in Flash</li>
</ol>
<p>You <strong>cannot</strong> disable the settings panel.</p>
<p>Here are a few helpful tips that I have figured out:</p>
<ul>
<li>The widget needs to be 216 x 138 ONLY when you&#8217;re asking for permission to the microphone.  If you have control of Javascript on the page, you can change the size of the flash object on the page temporarily while you show the settings panel.</li>
<li>You can use &#8220;Security.showSettings(SecurityPanel.PRIVACY);&#8221; to control when you want the settings panel to show up. Using the Security.showSettings method is helpful because there is a Remember button on that panel.  If the user chooses &#8220;Remember&#8221;, then you never have to show the Settings panel again.</li>
<p><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/micsettings.gif" alt="micsettings" title="micsettings" width="214" height="138" class="alignnone size-full wp-image-520" /></p>
<li>The Microphone status events get dispatched when a user changes a Microphone setting within the settings panel. ( _mic.addEventListener(StatusEvent.STATUS, onMicStatus); )</li>
<li>On your Microphone class, the &#8220;muted&#8221; property will tell you if you have access to the microphone or not.</li>
</ul>
<p>These tips can be adapted for the camera settings panel as well.<br />
<br/></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.natebeck.net/2009/01/tip-of-the-day-tricks-of-the-mic-settings-panel/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Tip of the Day &#8211; Having an affair with Flash</title>
		<link>http://blog.natebeck.net/2009/01/tip-of-the-day-messing-around-with-flash/</link>
		<comments>http://blog.natebeck.net/2009/01/tip-of-the-day-messing-around-with-flash/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 07:48:21 +0000</pubDate>
		<dc:creator>Nate Beck</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Tip of the day]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.natebeck.net/?p=493</guid>
		<description><![CDATA[Expert Flash developers such as Grant Skinner, Keith Peters and Mr. Doob didn&#8217;t become Flash experts overnight. Take a look at Keith&#8217;s old labs page, or Grant&#8217;s Gallery Incomplet. These guys have been playing around and experimenting with the Flash platform for years. Maybe you&#8217;re one of those people who say to themselves, I simply]]></description>
			<content:encoded><![CDATA[<p>Expert Flash developers such as <a href="http://www.gskinner.com/" target="_blank">Grant Skinner</a>, <a href="http://www.bit-101.com/blog/" target="_blank">Keith Peters</a> and <a href="http://mrdoob.com/" target="_blank">Mr. Doob</a> didn&#8217;t become Flash experts overnight.  Take a look at <a href="http://www.bit-101.com/blog/?page_id=1164" target="_blank">Keith&#8217;s old labs</a> page, or Grant&#8217;s <a href="http://incomplet.gskinner.com/" target="_blank">Gallery Incomplet</a>.  These guys have been playing around and experimenting with the Flash platform for years.</p>
<p>Maybe you&#8217;re one of those people who say to themselves, I simply don&#8217;t have enough time to screw around with my own stuff&#8230; I&#8217;m way too busy&#8230; I need my insulin&#8230; I don&#8217;t know anything about math or physics. Well, cut the excuses and make the time! All it take is twenty minutes a day. Twenty minutes a day turns into more than 3 full work weeks a year. Don&#8217;t believe me? Here is the math: </p>
<p>20 minutes * 365 days / 60 hours / 8 hour work day = <strong>15.2083 work days</strong></p>
<p>If you&#8217;re like me, once you start experimenting those 20 minutes fly by, and before you know it your significant other is yelling at you that dinner is ready.</p>
<p>For example, it&#8217;s been snowing off and on here in Seattle. As I was gazing at the window watching the snow come down, I decided to try my hand at writing particle systems. <a href="http://en.wikipedia.org/wiki/Particle_system" target="_blank">Particle systems</a> are something that have always intrigued me but I never could &#8220;find&#8221; the time. So instead of putting particles in the back of my mind (and ultimately never getting around to them), this weekend I researched and spent a few hours learning about particle systems.  And I programmed this (move the mouse around):</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_test_smoke_747507804"
			class="flashmovie"
			width="550"
			height="380">
	<param name="movie" value="http://blog.natebeck.net/flash/experiments/test_smoke.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://blog.natebeck.net/flash/experiments/test_smoke.swf"
			name="fm_test_smoke_747507804"
			width="550"
			height="380">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
<br/><br />
It&#8217;s nothing breath-taking, but you know what&#8230; I know how to write a particle system now.<br />
<br/></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.natebeck.net/2009/01/tip-of-the-day-messing-around-with-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tip of the Day &#8211; When to use include</title>
		<link>http://blog.natebeck.net/2009/01/tip-of-the-day-when-to-use-include/</link>
		<comments>http://blog.natebeck.net/2009/01/tip-of-the-day-when-to-use-include/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 07:31:20 +0000</pubDate>
		<dc:creator>Nate Beck</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tip of the day]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.natebeck.net/?p=277</guid>
		<description><![CDATA[A little while ago I posed the following question to the flexcoders mailing list, I just wanted to ping everyone and get their opinion on something. Why would anyone ever want to use the include directive? I&#8217;ve recently been working on poorly designed project where at the top of every module there is an &#8220;include]]></description>
			<content:encoded><![CDATA[<p>A little while ago I posed the following question to the <a href="http://tech.groups.yahoo.com/group/flexcoders/">flexcoders</a> mailing list,</p>
<blockquote><p>
I just wanted to ping everyone and get their opinion on something.  Why would anyone ever want to use the include directive?  I&#8217;ve recently been working on poorly designed project where at the top of every module there is an &#8220;include Header.as&#8221; statement that has 30 include statements within it.  To give a datagrid additional functionality, you give it an id=&#8221;myDataGrid&#8221;, and the include statement takes care of the rest.  It&#8217;s really bad.</p>
<p>I just don&#8217;t see a good use for the include statement anymore. In my opinion, it just promotes bad programming practices.</p>
<p>I mean, can&#8217;t everything be taken care of using OOP methodologies? Thoughts?
</p></blockquote>
<p>I&#8217;d like to thank everyone who responded, you all gave me quite a bit of insight.  </p>
<p>After thinking about this for a while now, here is my list of the common reasons people incorrectly use include (<a href="http://livedocs.adobe.com/flex/2/langref/statements.html#include">include directive</a>).</p>
<h4>I have common functionality that I want shared across multiple components.</h4>
<p>That&#8217;s great that you&#8217;re using <a href="http://en.wikipedia.org/wiki/Don't_repeat_yourself">DRY</a> philosophy! However, it&#8217;s much better to combine the DRY philosophy with <a href="http://en.wikipedia.org/wiki/Object-oriented_programming">object-oriented programming</a> practices. Instead of using the include directive, abstract out common functionality into a parent class. Then you can create children of your parent component, and add additional functionality as needed.</p>
<h4>I&#8217;m building a framework.</h4>
<p>Great&#8230; don&#8217;t use include.  See above reason.</p>
<h4>I want to use Code-Behind.</h4>
<p>Ted Patrick wrote a wonderful post on <a href="http://www.onflex.org/ted/2007/02/code-behind-in-flex-2.php">Code-Behind in Flex 2</a>. He accomplishes Code-Behind, and does so in an object-oriented manner without using include statements.</p>
<h4>Adobe doesn&#8217;t natively allow multiple inheritance in AS3, and using the include directive is the only way to fake it.</h4>
<p>Frankly, if you understand that statement&#8230; you&#8217;re advanced enough to know what you&#8217;re doing, and you don&#8217;t need this tip.</p>
<h4>== Conclusion ==</h4>
<p>There are <strong><i>rare</i></strong> occasions where include is exactly what you need. However, if you still feel you have a valid reason to use the include directive on a regular basis, please leave a comment below and explain yourself.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.natebeck.net/2009/01/tip-of-the-day-when-to-use-include/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Widget development on the Flash Platform</title>
		<link>http://blog.natebeck.net/2009/01/widget-development-on-the-flash-platform/</link>
		<comments>http://blog.natebeck.net/2009/01/widget-development-on-the-flash-platform/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 09:20:39 +0000</pubDate>
		<dc:creator>Nate Beck</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Widgets]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.natebeck.net/?p=101</guid>
		<description><![CDATA[An interesting conversation has been happening for a while over on flexcoders. The conversation started with a simple question&#8230; Whether or not using the Flex framework is a good idea when developing widgets. First a little background about me. A little while back, I worked for a small startup named Snapvine. Snapvine currently has many]]></description>
			<content:encoded><![CDATA[<p>An interesting conversation has been happening for a while over on flexcoders.  The conversation started with a simple question&#8230; Whether or not using the Flex framework is a good idea when developing widgets.</p>
<p>First a little background about me.</p>
<p>A little while back, I worked for a small startup named <a href="http://www.snapvine.com/">Snapvine</a>. Snapvine currently has many <a href="http://www.snapvine.com/widgets">widget offerings</a>, one of which still gets loaded millions of times each week.  These widgets are deployed across hundreds of social networks (who knew there were so many).  As the lone flash developer in the company, it was my job was to create and maintain all of these widgets.</p>
<p>The great thing about Snapvine was that I was surrounded by brilliant people, we discussed the Flex framework in extraordinary detail, weighing the pros and cons of using such a framework in our widgets.</p>
<p>So that brings me to the whole point of this blog post&#8230; pros and cons for building widgets for the Adobe Flash Platform using Flex.  </p>
<p>[Sidenote]</p>
<p>My experience in widget development was mostly focused on development for social networks, so I might say some things that may not apply to other types of widget development.</p>
<p>[/Sidenote]</p>
<h2>&#8211; Pros &#8211;</h2>
<h3>Flex does a lot of the work for you</h3>
<p>Flex does so much of the heavy lifting for us. If you&#8217;re ever bored, skim through the <a href="http://livedocs.adobe.com/flex/3/langref/">Flex documentation</a>. It&#8217;s not uncommon for me to find things within the framework I didn&#8217;t know existed.</p>
<p>Also, If you haven&#8217;t already done so, I highly recommend picking up the <a href="http://oreilly.com/catalog/9780596529857/">O&#8217;Reilly Flex 3 Cookbook</a>, or thumbing through it at your local bookstore. I&#8217;ve found some really great things in there that I didn&#8217;t know about the Flex Framework.</p>
<p>Flex allows quicker development time because there is less code YOU have to write.</p>
<p>Once again, Thanks Adobe&#8230; for doing my work for me.</p>
<h3>RSLs decrease frequent loading time</h3>
<p>The use of Adobe&#8217;s Runtime Shared Library significantly reduces multiple loads of your widget. This is because parts of the Flex Framework become cached inside the Flash Player itself.  One of the big benefits of the framework RSLs is that not only your widget benefit from them.  The framework is cached the first time ANY Flex content, on any site, using framework RSLs is loaded.</p>
<p>One caveat to Runtime Shared Libraries is that you have to configure your widget to utilize them during compilation. They don&#8217;t just get used magically. This also means that when you deploy the widget on your web server, you need to also upload and distribute the RSLs.</p>
<p>So if a user visits <a href="http://www.picnik.com/app">Picnik</a>, which uses the Flex framework RSLs. Then the user visits a myspace profile page with your widget on it, they wouldn&#8217;t download the framework RSLs again (if you and picnik.com are using the same version of the SDK).</p>
<h3>Myspace wants users to use Flash Player 9 and above</h3>
<p>A while back Adobe and MySpace scratched each other&#8217;s back a little bit. Adobe added support for MySpace to disallow navigation events from flash widgets (allowNetworking=&#8221;internal&#8221;), and MySpace in turn highly recommend users to upgrade to Flash Player 9 (I&#8217;m pretty sure they also did this for the video support in Flash Player 9). Myspace did this by prompting users to update their Flash Player if they detected version 8 and below.  </p>
<p>That&#8217;s a BIG pro for us widget developers, because that means the majority of our widget market is using a player with loads of the features we know and love.  At the time of this writing, I&#8217;m unsure if MySpace is pushing Flash Player 10, I haven&#8217;t noticed it yet.</p>
<p>[Rant]</p>
<p>I&#8217;m currently writing this post aboard an airplane at 33,000 feet. Would the person who keeps passing gas, please knock it off, this is an enclosed air system for heaven&#8217;s sake.</p>
<p>[/Rant]</p>
<h2>&#8211; Cons &#8211;</h2>
<h3>Flex is huge, comparatively</h3>
<p>300 KB is still too big for dial-up.  Many people argue that if people are using MySpace on dial-up, that they&#8217;re used to slow loading times.  It&#8217;s not uncommon for a MySpace profile to be littered with hundreds of 100 KB photos, music, etc&#8230;  However, that brings me to one of my main points.  </p>
<p>By keeping your widget small, It&#8217;s more than likely going to load prior to other things on the profile.  This is key for getting your brand out there. In Snapvine&#8217;s case, this meant that before pictures of friends, before the music players, before the slideshows&#8230; Snapvine&#8217;s logo was spinning on the page.</p>
<h3>Bandwidth is expensive</h3>
<p>If your goal if for your widget to go viral, bandwidth is something you should consider. It is bandwidth which drives how much money you are going to spend.</p>
<p>This calculator estimates how much it would cost if you were hosting your widget on <a href="http://aws.amazon.com/s3/">Amazon S3 (US)</a>.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_BandwidthCalc_1647720416"
			class="flashmovie"
			width="400"
			height="380">
	<param name="movie" value="http://blog.natebeck.net/flash/BandwidthCalc/BandwidthCalc.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://blog.natebeck.net/flash/BandwidthCalc/BandwidthCalc.swf"
			name="fm_BandwidthCalc_1647720416"
			width="400"
			height="380">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<h6>If you want a direct link&#8230; <a href="http://blog.natebeck.net/flash/BandwidthCalc/" >Widget Bandwidth Calculator</a><br />
If you are curious, you can <a href="http://blog.natebeck.net/flash/BandwidthCalc/srcview/index.html" target="_blank">view the source</a>.</h6>
<p>Why is this a con? Using the Flex framework bloats a swf&#8217;s file size, and ultimately costs you more money, even if you are using Runtime Shared Libraries.  </p>
<p><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/comboboxtest.jpg" alt="A simple application only using a combo box is still 56 KB" title="Combo Box Test" width="400" height="378" class="size-full wp-image-130" /></p>
<p>A simple application which is JUST a combo box, is still 56 KB, even when using Runtime Shared Libraries.</p>
<h3>Flex was built primarily for Enterprise Development</h3>
<p>This means that lots of the components within the framework, are pretty much useless within widgets.  For example, using a datagrid to show massive amounts of data&#8230; not really a good use for a widget.  </p>
<p>Remember, we&#8217;re talking about widgets, not about widgapplications (my spellcheck doesn&#8217;t like that word). Most widgets are fairly simple apps.  Examples &#8211; a music player, slideshow, <a href="http://www.animoto.com/" target="_blank">awesome video slideshow</a>, small game, etc&#8230;</p>
<p>Keep your widget fairly simple, if it begins to become too complex, you should probably ask yourself, &#8220;Should I be building a 3rd party application (OpenSocial or FBML) instead of a widget?&#8221;</p>
<h3>It&#8217;s hard to selectively use pieces of Flex</h3>
<p>I&#8217;m not going to say that it is impossible, but loads of classes in the Flex framework are dependent upon each other.  Which means that if you&#8217;re going to use one Flex class within your widget, it will import ALL of it&#8217;s dependencies, whether you use them or not.</p>
<h2>&#8211; Nate&#8217;s opinion &#8211;</h2>
<p>If I&#8217;m building a widget whose soul purpose is to go viral and be loaded millions of times a day, I&#8217;m going to write it in straight ActionScript.  </p>
<p>Sure, it will take a bit more time, but in the end I&#8217;ll save money, have more granular control over my widget, and feel good about myself.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.natebeck.net/2009/01/widget-development-on-the-flash-platform/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Why YOU should contribute to Flex.</title>
		<link>http://blog.natebeck.net/2008/12/why-you-should-contribute-to-flex/</link>
		<comments>http://blog.natebeck.net/2008/12/why-you-should-contribute-to-flex/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 07:37:03 +0000</pubDate>
		<dc:creator>Nate Beck</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[contribute]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.natebeck.net/?p=64</guid>
		<description><![CDATA[So I&#8217;ve been developing Flex since the 1.5 days, and before that using &#60;cfform format=&#34;flash&#34;&#62;, aka flex-lite. Yet, until recently I haven&#8217;t really been too involved with the community&#8230; well unless I needed something. I guess I&#8217;ve pretty much been self-absorbed and in my own little world. I&#8217;ve now realized that the only reason I&#8217;ve]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve been developing Flex since the 1.5 days, and before that using &lt;cfform format=&quot;flash&quot;&gt;, aka flex-lite. Yet, until recently I haven&#8217;t really been too involved with the community&#8230; well unless I needed something. I guess I&#8217;ve pretty much been self-absorbed and in my own little world.</p>
<p>I&#8217;ve now realized that the only reason I&#8217;ve ever found what I needed was because someone was willing to share. I know, I know&#8230; you knew that already&#8230; sometimes I&#8217;m one taco short of a combination plate.</p>
<p>So here are the reasons why YOU should get involved with the Flex (and flash) open source world.</p>
<ul>
<li><a href="#adobe">The Adobe Team</a></li>
<li><a href="#help">They&#8217;re asking for help!</a></li>
<li><a href="#matters">Take matters into your own hands</a></li>
<li><a href="#ourframework">YOU have a say</a></li>
<li><a href="#notcoder">You don&#8217;t have to be a programmer (or an expert programmer)</a></li>
<li><a href="#flexcoders">FlexCoders Mailing List</a></li>
<li><a href="#flash">Flash isn&#8217;t going anywhere</a></li>
<li><a href="#conclusion">Conclusion</a></li>
</ul>
<p><h3 id="adobe">The Adobe Team</h3>
<p>    I had the opportunity to meet some of the Flex team. And let me tell you, these guys (and girls&#8230; ahmmm.. Deepa) really care about this project.  I&#8217;ve never seen a group so devoted to what they do.  If you&#8217;ve had the chance to read through the <a href="http://opensource.adobe.com/wiki/display/flexsdk/Gumbo#Gumbo-DocumentsandSpecifications">specs</a> that the team is putting online.  You will see how well thought out the SDK is.
</p>
<p>
	It&#8217;s also not uncommon to see the Adobe team participating within the community.  If you&#8217;re subscribed to FlexCoders, you&#8217;ll frequently see members of the Flex SDK team answering questions and making comments.  They also answer questions on the <a href="http://www.adobe.com/cfusion/webforums/forum/index.cfm?forumid=60"> Adobe forums</a>.  I&#8217;m pretty sure the team at Adobe already has a full plate. Yet, they still contribute to the community.  They go above and beyond the <a href="http://www.callofduty.com/">call of duty</a>.  For example, as I&#8217;m writing this post at 10pm PST on a Sunday night, I&#8217;m watching <a href="http://blogs.adobe.com/aharui/">Alex Harui</a> answering questions on the FlexCoders mailing list.  Thanks Alex.
</p>
<p><h3 id="help">They&#8217;re asking for help!</h3>
<p>    Most people don&#8217;t realize how easy it is to get involved with open source Adobe products.  Everyone can (and should) sign up for the <a href="http://bugs.adobe.com/">Bug and Issue Management System</a>. It&#8217;s quick and easy to get setup.
</p>
<p>
	If you&#8217;re a developer, <a href="http://opensource.adobe.com/wiki/display/flexsdk/Submitting+a+Patch">become a contributor</a> and submit patches.  It&#8217;s actually much more painless than I thought it would be.  I faxed over my Contributor Agreement and was approved within 20 minutes.
</p>
<p><h3 id="matters">Take matters into your own hands</h3>
<p>    One thing that I have been guilty of in the past is complaining that the Flex framework, or Flash in general, is missing what I consider no brainers.  I found myself saying, &#8220;Self, why on earth would the person writing the Date class not think that someone, somewhere would want to change the timezone offset&#8221;, or other types of complaints.  I soon realized that, Nate you dummy, this is an open source project.  Fix it yourself! (again&#8230; sometimes I&#8217;m slow).  It hit me like a ton of bricks: If you build it, they will come&#8230; errr&#8230;. include it into the framework.
</p>
<p>
	It&#8217;s more likely that a feature will be put into the framework if it&#8217;s already written for them. Heck, in my previous post I was amazed by how quickly my fix was committed to the code repository. Adobe wants us to help!  Which is a great place to move on to my next point.
</p>
<p><h3 id="ourframework">YOU have a say</h3>
<p>    YOU have a say! It&#8217;s our framework.  Sure, maybe Adobe has the final say on most of these things.  And sure, Adobe may mark your feature request as deferred.  But you know what, since it is open source with a public issue system, you do have a say.
</p>
<p>
	Every user within the Bug and Issue Management System has the option to vote on bugs and features.  This isn&#8217;t a dictatorship.  Adobe has given us to right to vote on issues, and if an issue is getting lots of attention from the community, they will look at it and likely fix it.
</p>
<p><h3 id="notcoder">You don&#8217;t even have to be a programmer (or an expert programmer)</h3>
<p>   I know there are some of you out there who don&#8217;t write code, or people who simply think, &#8220;I&#8217;m not a good enough programmer to contribute to the SDK&#8221;. Well good news, you can be part of the revolution too! You have the ability to contribute quality to the Flex Framework and Flash Platform.  Here are few ideas: Submit bugs, submit feature requests, correct spelling mistakes in documentation.  Get involved!
</p>
<p>
	In regards to bugs and feature requests, I cannot stress this enough. Before you submit a bug, please&#8230; PLEASE&#8230; <b>verify that the bug (or feature) doesn&#8217;t already exist</b>, do some research before you just willy nilly submit feature requests and bugs.  It ends up being counter productive. Other people doing the research you&#8217;ve should have done now have to spend time cleaning up the issue system because of duplicates and other issues.  Having said that, another thing that helps the community is to browse through the issue tracker looking for duplicates, or general cleanup of the issue tracker.  If you find something that needs to be cleaned up you can report it to Adobe and they will take care of it.
</p>
<p>
Anything that reduces the time others have to spend wading through issues is a good thing.  It means that the people who are writing fixes to the issues spend less time in the bug system, and more time fixing the issues themselves.
</p>
<p><h3 id="flexcoders">FlexCoders Mailing List</h3>
<p>    Now I should mention, that <a href="http://tech.groups.yahoo.com/group/flexcoders/">FlexCoders</a> is not a mailing list that is controlled by Adobe. It was started by a group of developers within the community. I&#8217;ve been following the list for a very long time, and frankly it&#8217;s kind of annoying. I&#8217;ll be in the middle of typing out a response to a question, when gmail pops up to tell me the conversation has been updated.  Maybe it&#8217;s just bad timing, but it always seems that someone else beats me to the punch.
</p>
<p>
	Another great thing about FlexCoders is the people that post there regularly.  I usually end up laughing over some debate or a nerdy joke that someone included in their response.
</p>
<p><h3 id="flash">Flash isn&#8217;t going anywhere</h3>
<p>    Let&#8217;s be honest here, against Silverlight&#8230; and whatever <a href="http://blogs.zdnet.com/Burnette/?p=300">Sun</a>, Google, Apple and everyone else is cooking up, The Flash platform is here to stay. With a <a href="http://www.adobe.com/products/player_census/flashplayer/version_penetration.html">~90% client install base</a>, and a large development following.  I don&#8217;t foresee Adobe taking their ball and going home.
</p>
<p>
So what does that mean for us developers? We have a stable, time tested platform to develop on. We don&#8217;t need to worry about the Adobe going under.
</p>
<p><h3 id="conclusion">Conclusion</h3>
<p>    The last point that I want to make&#8230; I&#8217;m proud to be a Flash developer. Looking at code that I submitted now being part of the Flex SDK just makes a person feel good.  I&#8217;m beginning to understand why the Adobe Team puts so much dedication into this platform.  And I have to admit, that dedication and devotion is contagious.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.natebeck.net/2008/12/why-you-should-contribute-to-flex/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

