
<?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 - Adobeholic &#187; Tutorials</title>
	<atom:link href="http://blog.natebeck.net/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.natebeck.net</link>
	<description>RIA Developer, Flex / Flash, Widgets</description>
	<lastBuildDate>Wed, 21 Jul 2010 19:20:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Developing games with PushButton Engine &#8211; Using the Console</title>
		<link>http://blog.natebeck.net/2009/11/developing-games-with-pushbutton-engine-using-the-console/</link>
		<comments>http://blog.natebeck.net/2009/11/developing-games-with-pushbutton-engine-using-the-console/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 09:38:10 +0000</pubDate>
		<dc:creator>Nate Beck</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[PushButton]]></category>
		<category><![CDATA[Tip of the day]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Console]]></category>
		<category><![CDATA[PBE]]></category>

		<guid isPermaLink="false">http://blog.natebeck.net/?p=888</guid>
		<description><![CDATA[One really cool feature that we have built into the PushButton Flash Game Engine is a console. Using the Console The only thing you need to do to include the Console into your project is call PBE.startup(). package &#123; import flash.display.Sprite; import com.pblabs.engine.PBE; &#160; public class HelloConsole extends Sprite &#123; public function HelloConsole&#40;&#41; &#123; PBE.startup&#40;this&#41;;]]></description>
			<content:encoded><![CDATA[<p>One really cool feature that we have built into the <a href="http://pushbuttonengine.com/">PushButton Flash Game Engine</a> is a console.</p>
<h3>Using the Console</h3>
<p>The only thing you need to do to include the Console into your project is call PBE.startup().</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> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</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>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> HelloConsole <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> HelloConsole<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>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Once your game is running, to access the console press the default hot key, which is the Tilde (~) / Grave (`) key. </p>
<p><a href="http://blog.natebeck.net/wp-content/uploads/2009/11/HelloConsole.png" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/11/HelloConsole-300x229.png" alt="HelloConsole" title="HelloConsole" width="300" height="229" class="alignnone size-medium wp-image-899" /></a></p>
<p>As of this post, the latest revision of the <a href="http://www.pushbuttonengine.com">PushButton Engine</a> is revision 702.  In this version there are some commands registered by default:</p>
<ul>
<li><b>help</b> &#8211; List known commands.</li>
<li><b>clear</b> &#8211; Clears the console history.</li>
<li><b>listDisplayObjects</b> &#8211; Outputs the display list.</li>
<li><b>showFps</b> &#8211; Show an FPS/Memory usage indicator.</li>
<li><b>verbose</b> &#8211; Set verbosity level of console output.</li>
<li><b>version</b> &#8211; Echo PushButton Engine version information.</li>
</ul>
<h3>Quick Tricks</h3>
<p>The console supports a few shortcuts to make your life easier:</p>
<ul>
<li>The console is not case-sensitive, so don&#8217;t worry if you put showFps or shOwFPS, the same command will execute.</li>
<li>You can use the up and down arrows to move through your command history.</li>
<li>By pressing enter on an empty command line, you can add new lines.  This is helpful for adding space between commands to make it easier to read.</li>
<li>You can use the &#8220;name&#8221; property on a DisplayObject to make meaningful names show up in the listDisplayObjects command.</li>
<li>Different Log Levels are colored by default, to change the colors edit com.pblabs.engine.debug.LogColor.</li>
</ul>
<h3>Creating custom commands for the console</h3>
<p>The PBE console also supports the ability for the developer to add their own commands.</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;">Console</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> ConsoleCommand <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> ConsoleCommand<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>;
			Console.<span style="color: #006600;">registerCommand</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;test&quot;</span>, onTestCommand, <span style="color: #ff0000;">&quot;This is a test command.&quot;</span><span style="color: #66cc66;">&#41;</span>;
			Console.<span style="color: #006600;">registerCommand</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;testStrict&quot;</span>, onTestStrict, <span style="color: #ff0000;">&quot;Test strict parameters.&quot;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		protected <span style="color: #000000; font-weight: bold;">function</span> onTestCommand<span style="color: #66cc66;">&#40;</span>... <span style="color: #006600;">args</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</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;onTestCommand: &quot;</span>+args<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		protected <span style="color: #000000; font-weight: bold;">function</span> onTestStrict<span style="color: #66cc66;">&#40;</span>str:<span style="color: #0066CC;">String</span>, num:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</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;You passed in the string: &quot;</span>+str<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;You passed in the number: &quot;</span>+num<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>Parameters are passed in sequence using spaces.  So to run the test command, I would open the console, and then type &#8220;test a b c 1 2 3&#8243;.  This would then call the onTestCommand method and pass in an array with 6 elements.</p>
<p>Below is an example of what using custom commands in the console looks like.</p>
<p><a href="http://blog.natebeck.net/wp-content/uploads/2009/11/ConsoleCommand.png"><img src="http://blog.natebeck.net/wp-content/uploads/2009/11/ConsoleCommand-300x229.png" alt="ConsoleCommand" title="ConsoleCommand" width="300" height="229" class="alignnone size-medium wp-image-895" /></a></p>
<h3>Changing the Console HotKey</h3>
<p>Some of our good friends over in the Netherlands use different keyboard layouts, so they requested the ability to change the hot key binding to another key.</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;">core</span>.<span style="color: #006600;">InputKey</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;">Console</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>;
	<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;">UIAppender</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">StageAlign</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">StageScaleMode</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TestConsole <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> TestConsole<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>;
&nbsp;
			UIAppender.<span style="color: #006600;">hotKey</span> = InputKey.<span style="color: #006600;">C</span>.<span style="color: #006600;">keyCode</span>;
			Console.<span style="color: #006600;">registerCommand</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;test&quot;</span>, onTestCommand, <span style="color: #ff0000;">&quot;My test command&quot;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		protected <span style="color: #000000; font-weight: bold;">function</span> onTestCommand<span style="color: #66cc66;">&#40;</span>... <span style="color: #006600;">args</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</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;onTestCommand: &quot;</span>+args<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><font color="#FF0000"><b>WARNING!!!</b></font> When changing the hot key to another key, the input textfield doesn&#8217;t escape the new key binding.  So you must remove focus from the input field to use the hot key to close the console.</p>
<p>More information on this can be found in <a href="http://code.google.com/p/pushbuttonengine/issues/detail?id=98">issue 98</a>.</p>
<h3>What&#8217;s coming?</h3>
<p>I do have plans on adding either tab-complete or a drop-down auto complete list into the console which will match avaliable commands.</p>
<p>Another thing that I&#8217;m currently working on is code-named Tumbler.  It&#8217;s and Adobe AIR version of the console which has additional features to assist in debugging and troubleshooting your games.  </p>
<p>It&#8217;s a proof-of-concept at the moment&#8230; but if there is enough interest in it&#8230; I may spend more time on it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.natebeck.net/2009/11/developing-games-with-pushbutton-engine-using-the-console/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Tip of the Day &#8211; Quick and inexpensive design work</title>
		<link>http://blog.natebeck.net/2009/02/tip-of-the-day-quick-and-inexpensive-design-work/</link>
		<comments>http://blog.natebeck.net/2009/02/tip-of-the-day-quick-and-inexpensive-design-work/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 04:00:43 +0000</pubDate>
		<dc:creator>Nate Beck</dc:creator>
				<category><![CDATA[Tip of the day]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[elance]]></category>
		<category><![CDATA[mturk]]></category>

		<guid isPermaLink="false">http://blog.natebeck.net/?p=650</guid>
		<description><![CDATA[Using Amazon&#8217;s Mechanical Turk in combination with outsourcing your design task to Elance, you can get great designs and user feedback very quickly, easily and for very little money. Step 1: Post your job &#8220;design a logo&#8221; on Elance (elance.com). Be sure to include instructions including other designs that inspire you and a description of]]></description>
			<content:encoded><![CDATA[<p>Using Amazon&#8217;s <a href="http://www.mturk.com" target="_blank">Mechanical Turk</a> in combination with outsourcing your design task to <a href="http://www.elance.com" target="_blank">Elance</a>, you can get great designs and user feedback very quickly, easily and for very little money.</p>
<p><strong>Step 1:</strong>  Post your job &#8220;design a logo&#8221; on Elance (elance.com).  Be sure to include instructions including other designs that inspire you and a description of your product vision and intended audience.</p>
<p><strong>Step 2:</strong>  After selecting a designer, ask them to create 3 to 5 draft design mocks</p>
<p><strong>Step 3:</strong>  Using mechanical turk (mturk.com), submit each design option to mechanical turk as a survey (e.g. &#8220;which design do you like best&#8221;).  You can choose any number of people to answer your survey.  Estimated cost:  100 people at $0.10 each = $10</p>
<p><strong>Step 4: </strong> Review results.</p>
<p>I&#8217;ve found that using this technique that for about $10 I can get around 100 people to tell me which design they prefer and offer suggestions.  Also, I usually ask for the age, country and background of the participant so I can filter down to an audience that matches my purposes.</p>
<p><em><br />
<h5>This tip was provided by Joe H.  Excellent tip Joe!</h5>
<p></em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.natebeck.net/2009/02/tip-of-the-day-quick-and-inexpensive-design-work/feed/</wfw:commentRss>
		<slash:comments>0</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_2135196100"
			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_2135196100"
			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_2058868787"
			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_2058868787"
			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>9</slash:comments>
		</item>
		<item>
		<title>Tip of the Day &#8211; Using Fireworks to skin those Flex Applications</title>
		<link>http://blog.natebeck.net/2009/01/tip-of-the-day-using-fireworks-to-skin-those-flex-applications/</link>
		<comments>http://blog.natebeck.net/2009/01/tip-of-the-day-using-fireworks-to-skin-those-flex-applications/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 16:47:41 +0000</pubDate>
		<dc:creator>Nate Beck</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tip of the day]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Fireworks]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[SeaFlex]]></category>
		<category><![CDATA[skinning]]></category>

		<guid isPermaLink="false">http://blog.natebeck.net/?p=310</guid>
		<description><![CDATA[Today I was going to post about using flashvars and widget development. However, as I started to document the process, it became too much information for a single tip. So I&#8217;m going to do a separate post walking you through my widget development process. Now on to today&#8217;s tip! To be honest with you guys,]]></description>
			<content:encoded><![CDATA[<p>Today I was going to post about using flashvars and widget development.  However, as I started to document the process, it became too much information for a single tip.  So I&#8217;m going to do a separate post walking you through my widget development process. Now on to today&#8217;s tip!   </p>
<p>To be honest with you guys, I&#8217;ve never really been a huge fan of Fireworks.  I&#8217;m a Photoshop guy, and I have been since version 5.5 (hooray ImageReady).  However, at our last <a href="http://www.seaflexug.org/">SeaFlex</a> meeting <a href="http://theflexguy.com/">Marty</a> gave a quick introduction into Flex skinning using Fireworks. My eyes were opened! So here is the basic run down of creating Flex skins using Fireworks CS4.</p>
<ol>
<li>Within Fireworks go to Commands &gt; Flex Skinning &gt; New Flex Skin<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/fwskin_01.jpg" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/fwskin_01-300x214.jpg" alt="fwskin_01" title="fwskin_01" width="300" height="214" class="alignnone size-medium wp-image-314" /></a></li>
<li>Select the components you want to skin.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/fwskin_02.jpg" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/fwskin_02-249x300.jpg" alt="fwskin_02" title="fwskin_02" width="249" height="300" class="alignnone size-medium wp-image-315" /></a></li>
<li>Skin to your heart&#8217;s desire.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/fwskin_03.jpg" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/fwskin_03-300x189.jpg" alt="fwskin_03" title="fwskin_03" width="300" height="189" class="alignnone size-medium wp-image-316" /></a></li>
<li>When you&#8217;re finished, go to Commands &gt; Flex Skinning &gt; Export Flex Skin<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/fwskin_04.jpg"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/fwskin_04-300x146.jpg" alt="fwskin_04" title="fwskin_04" width="300" height="146" class="alignnone size-medium wp-image-324" /></a></li>
<li>I created a new folder called testSkin and saved to that.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/fwskin_05.jpg" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/fwskin_05-300x262.jpg" alt="fwskin_05" title="fwskin_05" width="300" height="262" class="alignnone size-medium wp-image-325" /></a></li>
<li>Now in Flex Builder.  File &gt; Import &gt; Skin Artwork<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/fwskin_06.jpg" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/fwskin_06-300x277.jpg" alt="fwskin_06" title="fwskin_06" width="300" height="277" class="alignnone size-medium wp-image-326" /></a></li>
<li>Browse to the folder we just exported our assets to.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/fwskin_07.jpg" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/fwskin_07-295x300.jpg" alt="fwskin_07" title="fwskin_07" width="295" height="300" class="alignnone size-medium wp-image-327" /></a></li>
<li>Make sure the image to component mappings are correct.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/fwskin_08.jpg" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/fwskin_08-297x300.jpg" alt="fwskin_08" title="fwskin_08" width="297" height="300" class="alignnone size-medium wp-image-328" /></a></li>
<li>And&#8230;. you&#8217;re done.<br />
<a href="http://blog.natebeck.net/wp-content/uploads/2009/01/fwskin_09.jpg" target="_blank"><img src="http://blog.natebeck.net/wp-content/uploads/2009/01/fwskin_09-300x168.jpg" alt="fwskin_09" title="fwskin_09" width="300" height="168" class="alignnone size-medium wp-image-329" /></a></li>
</ol>
<p>Amazing.</p>
<h3>:: UPDATE ::</h3>
<p>Marty just posted a PC (and more in depth version) of the skinning your Flex applications with Fireworks.  <a href="http://www.theflexguy.com/index.php?option=com_content&#038;view=article&#038;id=97:skinning-with-fireworks&#038;catid=35:marty">Read it here!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.natebeck.net/2009/01/tip-of-the-day-using-fireworks-to-skin-those-flex-applications/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
