<?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>Shaun Smith &#187; swc</title>
	<atom:link href="http://shaun.boyblack.co.za/blog/tag/swc/feed/" rel="self" type="application/rss+xml" />
	<link>http://shaun.boyblack.co.za/blog</link>
	<description>Flex, Ruby, Mongo - London, UK</description>
	<lastBuildDate>Sat, 04 Feb 2012 17:39:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Getting Started with FlashDevelop3 and AS3</title>
		<link>http://shaun.boyblack.co.za/blog/2008/03/08/getting-started-with-flashdevelop3-and-as3/</link>
		<comments>http://shaun.boyblack.co.za/blog/2008/03/08/getting-started-with-flashdevelop3-and-as3/#comments</comments>
		<pubDate>Sat, 08 Mar 2008 00:53:24 +0000</pubDate>
		<dc:creator>shaun</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flashdevelop]]></category>
		<category><![CDATA[flexsdk]]></category>
		<category><![CDATA[swc]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/2008/03/08/getting-started-with-flashdevelop3-and-as3/</guid>
		<description><![CDATA[Aha! Finally. Time for my first tutorial: Getting up and running with FlashDevelop3. Firstly, FlashDevelop 3 only runs on Windows XP/Vista, and requires the .NET 2 runtime. Additionally, to compile AS3 code you will need the Java 1.6 runtime and the Adobe Flex SDK. Ok, let&#8217;s go! Part 1 &#8211; Downloading, Installing, and Compiling a SWF Let&#8217;s begin by setting things up and compiling our first SWF. Download the Adobe Flex SDK (just the Flex 3 SDK, not Flex Builder), &#8230; <a href="http://shaun.boyblack.co.za/blog/2008/03/08/getting-started-with-flashdevelop3-and-as3/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Aha! Finally. Time for my first tutorial: Getting up and running with <a title="FlashDevelop" href="http://www.flashdevelop.org/" target="_blank">FlashDevelop3</a>.</p>
<p>Firstly, FlashDevelop 3 only runs on Windows XP/Vista, and requires the .NET 2 runtime. Additionally, to compile AS3 code you will need the Java 1.6 runtime and the <a title="Adobe Flex SDK" href="http://www.adobe.com/go/flex3_sdk" target="_blank">Adobe Flex SDK</a>. Ok, let&#8217;s go!</p>
<p><span id="more-49"></span></p>
<p><strong>Part 1 &#8211; Downloading, Installing, and Compiling a SWF</strong></p>
<p>Let&#8217;s begin by setting things up and compiling our first SWF.</p>
<ol>
<li>Download the <a title="Adobe Flex SDK" href="http://www.adobe.com/go/flex3_sdk" target="_blank">Adobe Flex SDK</a> (just the Flex 3 SDK, not Flex Builder), and unpack it somewhere easy to find (C:FlexSDKFlex3).</li>
<li>Download the latest version of <a title="FlashDevelop" href="http://www.flashdevelop.org/community/viewforum.php?f=11" target="_blank">FlashDevelop</a>, install it and run it.</li>
<li>Create a New Project, under ActionScript 3 choose Default Project, and give it a name (&#8220;hello&#8221;).</li>
<li>In the Project Panel expand the &#8220;src&#8221; folder and open up &#8220;Main.as&#8221;</li>
<li>In the constructor add the code: trace(&#8220;hello world!&#8221;);</li>
<li>Hit Ctrl-Enter (or F5). A dialog should pop up asking if you&#8217;d like to open the AS3 context settings. Click &#8220;OK&#8221;.</li>
<li>In the &#8220;Flex SDK Location&#8221; input field enter the path from step 1 (or browse to it).</li>
<li>Hit Ctrl-Enter again. This should compile your code into a SWF and launch it in a tab. The Flex 3 compiler does incremental compiling, so the first compile might take a while, but subsequent compiles should be much faster.</li>
<li>Make a &#8220;whooping&#8221; noise! &#8220;hello world!&#8221; should be displayed in the Output panel. You&#8217;ll find the SWF sitting in the &#8220;bin&#8221; folder. Notice that the project panel let&#8217;s you look into the guts of your SWF.. pretty damn sweet!</li>
</ol>
<p><strong>Part 2 &#8211; Some Adjustments</strong></p>
<p>By default, FlashDevelop launches SWFs in it&#8217;s own version of the Flash Player. At the time of this writing, the player doesn&#8217;t perform quite as well as the <a title="Adobe Flash Player" href="http://www.adobe.com/support/flashplayer/downloads.html" target="_blank">official debug version of the Adobe Flash Player</a> (besides, we want all the goodness of the very latest Flash Player!). Also, I find the tabbed view weird. So let&#8217;s change our setup a bit.</p>
<ol>
<li>Head on over to <a title="Adobe Flash Player" href="http://www.adobe.com/support/flashplayer/downloads.html" target="_blank">Adobe downloads</a>, &#8220;Download the Windows Flash Player 9 Projector content debugger&#8221; and put it somewhere easy to find (C:FlexSDKFlashPlayer)</li>
<li>Back in FlashDevelop, go to the main menu, click &#8220;Tools&#8221; and select &#8220;Program Settings&#8221; (or hit F10)</li>
<li>In the left panel, under &#8220;Plugins&#8221; select FlashViewer, and point the &#8220;External Play Path&#8221; to the debug player executable from step 1.</li>
<li>While you&#8217;re there, change the &#8220;Movie Display Style&#8221; to &#8220;External&#8221;. Click &#8220;Close&#8221;.</li>
<li>At the top of the Project Panel click the &#8220;Project Properties&#8221; button (third from the left).</li>
<li>Under &#8220;Test Movie&#8221; change the selection to &#8220;Play in external player&#8221;, and click &#8220;OK&#8221;.</li>
<li>Hit Ctrl-Enter. Make the universal &#8220;Whazzamm&#8221; sound!</li>
</ol>
<p><strong>Part 3 &#8211; Attaching Assets to the Stage</strong></p>
<p>Perhaps &#8220;hello world!&#8221; is not that thrilling for you. Fine.</p>
<ol>
<li>Create a folder called &#8220;lib&#8221; inside your project folder (alongside &#8220;bin&#8221; and &#8220;src&#8221;).</li>
<li>Fire up Adobe Flash CS3 and create a new Flash File (Action Script 3.0).</li>
<li>Save it inside the &#8220;lib&#8221; folder from step 1 and call it &#8220;assets.fla&#8221;.</li>
<li>In the Flash IDE grab the Oval tool and draw a circle.</li>
<li>Select the circle and convert it to a symbol by hitting F8 (or right-click and select &#8220;Convert to Symbol&#8230;&#8221;).</li>
<li>Give it the name &#8220;Circle&#8221; and expand the Linkage panel by clicking &#8220;Advanced&#8221;.</li>
<li>Under &#8220;Linkage&#8221; tick &#8220;Export for ActionScript&#8221; and click &#8220;OK&#8221;.</li>
<li>Open up your Publish Settings (Ctrl-Shift-F12), deselect &#8220;HTML&#8221;, and flip to the &#8220;Flash&#8221; tab</li>
<li>Tick &#8220;Export SWC&#8221;, click &#8220;Publish&#8221; and click &#8220;OK&#8221;.</li>
<li>Save the file and close the Flash IDE.</li>
<li>Flip back to FlashDevelop, and expand the &#8220;lib&#8221; folder in the Project Panel.</li>
<li>Right-click &#8220;assets.swc&#8221; and select &#8220;Add To Library&#8221;.</li>
<li>Replace our &#8220;trace&#8221; statement with the following code:<br />
var circle:Circle = new Circle();<br />
addChild( circle );</li>
<li>Hit Ctrl-Enter. Loudly exclaim &#8220;Golly, this is the biznis!&#8221;.</li>
</ol>
<p><strong>Part 4 &#8211; Extending Assets, Adding Interactivity</strong></p>
<p>Perhaps a plain old circle on the stage doesn&#8217;t really do it for you. You want some motion. You want some interactivity. Some filters. Fine then. Let&#8217;s do it..</p>
<ol>
<li>In the Project Panel, right click the &#8220;src&#8221; folder, select &#8220;New&#8221; &#8220;Class&#8221;, name it &#8220;ReactiveCircle&#8221; and click &#8220;OK&#8221;.</li>
<li>Head to the end of the line &#8220;public class ReactiveCircle&#8221;, type &#8220;extends&#8221;, hit Space and select &#8220;Circle&#8221;.</li>
<li>In the constructor type &#8220;filters = [new DropShadowFilter()];&#8221;</li>
<li>On the next line type &#8220;addEventListener(&#8221; and press Ctrl-Alt-Space (this enables autocompletion for all available classes, not just the imported ones). Start typing &#8220;MouseEvent&#8221; but hit Enter as soon as you see it selected. Complete the statement with &#8220;.CLICK, onClick);&#8221;</li>
<li>Move your cursor back onto the word &#8220;onClick&#8221;, press Ctrl-Shift-1 and hit Enter.</li>
<li>Inside the generated event handler add the code: x += 10;</li>
<li>Flip back to the Main class and change:<br />
var circle:Circle = new Circle();<br />
to<br />
var circle:ReactiveCircle = new ReactiveCircle();</li>
<li>Hit Ctrl-Enter. Click the circle. Shout &#8220;Kapoww!&#8221;</li>
</ol>
<p>Ok, it&#8217;s not a fully fledged RIA, but it should be enough to get you started.</p>
<p>Happy Flashing!</p>
<p><a title="FlashDevelop hello project" href="http://shaun.boyblack.co.za/blog/wp-content/uploads/2008/03/hello.zip">FlashDevelop hello project</a></p>
]]></content:encoded>
			<wfw:commentRss>http://shaun.boyblack.co.za/blog/2008/03/08/getting-started-with-flashdevelop3-and-as3/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>

