<?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>/dev/stu &#187; tutorial</title>
	<atom:link href="http://www.stuartaxon.com/tag/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stuartaxon.com</link>
	<description>Adding LOC to the web.</description>
	<lastBuildDate>Mon, 09 Jan 2012 18:11:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Flex for developers &#8211; Bootstrapping</title>
		<link>http://www.stuartaxon.com/2008/11/29/flex-for-developers-bootstrapping/</link>
		<comments>http://www.stuartaxon.com/2008/11/29/flex-for-developers-bootstrapping/#comments</comments>
		<pubDate>Sat, 29 Nov 2008 23:31:10 +0000</pubDate>
		<dc:creator>stu</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[actionscript. ant]]></category>
		<category><![CDATA[bootstrap]]></category>
		<category><![CDATA[commandline]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.stuartaxon.com/?p=129</guid>
		<description><![CDATA[Get started with flex development quickly, using the free sdk and building with ant from the commandline.]]></description>
			<content:encoded><![CDATA[<p>A lot of information on the web is aimed at people who use flashdevelop and other guis to build flex apps, this article is aimed at developers.  I&#8217;ll give you the information to get started with flex development quickly, using the free sdk and building with ant from the commandline.</p>
<p>A passing knowledge of ant wouldn&#8217;t hurt either.</p>
<p>This tutorial uses the file <a href="http://www.stuartaxon.com/wp-content/uploads/2008/11/blankapp.zip">blankapp.zip</a> to help bootstrap you into the world of flex / actionscript development.</p>
<h2>Prerequisites</h2>
<h3>Flex SDK</h3>
<p>You will need the flex sdk available from the <a href="http://www.adobe.com/devnet/flex/">flex developer center</a></p>
<h3>Apache ant</h3>
<p>You will need <a href="http://ant.apache.org/">apache ant</a>, make sure that the bin folder is in your path.</p>
<p>Copy flexTasks.jar from the flex ant lib into your own ant lib folder.</p>
<h2>Setup</h2>
<p>Extract the <a href="http://www.stuartaxon.com/wp-content/uploads/2008/11/blankapp.zip">blankapp.zip</a> to a folder</p>
<p>Open build.xml and change the line &lt;property name=&#8221;FLEX_HOME&#8221; value=&#8221;/usr/flex/sdk3&#8243; /&gt; to point to the flex sdk.</p>
<h2>Build</h2>
<p>You can build it by typing</p>
<pre>ant build</pre>
<p>You should see some output like this</p>
<pre>Buildfile: build.xml

clean:
   [delete] Deleting directory C:\Documents and Settings\Stuart\Desktop\projects\flex\blankapp\build

init:
    [mkdir] Created dir: C:\Documents and Settings\Stuart\Desktop\projects\flex\blankapp\build

build:
    [mxmlc] Loading configuration file C:\usr\flex\sdk3\frameworks\flex-config.xml
    [mxmlc] Initial setup: 172ms
    [mxmlc] Loaded 8 SWCs: 391ms
    [mxmlc] C:\Documents and Settings\Stuart\Desktop\projects\flex\blankapp\src\blankapp_333027.cache (The system cannot
 find the file specified)
    [mxmlc] Files: 328 Time: 1562ms
    [mxmlc] Linking... 16ms
    [mxmlc] Optimizing... 125ms
    [mxmlc] SWF Encoding... 47ms
    [mxmlc] C:\Documents and Settings\Stuart\Desktop\projects\flex\blankapp\build\blankapp.swf (159158 bytes)
    [mxmlc] Persisting 33 compilation units... 15ms
    [mxmlc] Total time: 2328ms
    [mxmlc] Peak memory usage: 59 MB (Heap: 33, Non-Heap: 26)

BUILD SUCCESSFUL
Total time: 2 seconds</pre>
<p>A new file, blankapp.swf should now be in the build folder</p>
<p>Type</p>
<pre>ant deploy</pre>
<p>To copy it to the deploy directory (later you can customise this later).</p>
<p>If you open the blankapp.swf in the browser you should see something like this</p>
<p><a href="http://www.stuartaxon.com/wp-content/uploads/2008/11/blankapp.png"><img class="alignnone size-medium wp-image-130" title="blankapp" src="http://www.stuartaxon.com/wp-content/uploads/2008/11/blankapp.png" alt="" width="232" height="208" /></a></p>
<p>It&#8217;s fairly bare, but demonstrates some basic techniques and a couple of widgets.</p>
<h2>Mxml and Actionscript, how they link together</h2>
<p>There are two important parts, the blankapp.mxml and org/blankapp/BlankApp.as.</p>
<p>The mxml file defines the layout while the actionscript contains code to be executed.   In this case there is one mxml file, BlankApp.mxml which links to a single actionscript class, BlankApp (in the file src/org/blankapp/BlankApp.as).</p>
<p>The directory structure org/blankapp, defines the package, in much the same way as java packages.</p>
<p>The graphic below shows how the class is linked to the mxml and where the instance of the class is:</p>
<p><a href="http://www.stuartaxon.com/wp-content/uploads/2008/11/blankapp-files.png"><img class="alignnone size-full wp-image-131" title="blankapp-files" src="http://www.stuartaxon.com/wp-content/uploads/2008/11/blankapp-files.png" alt="" width="666" height="822" /></a></p>
<p>The app is very basic, but should provide a jumping off point.</p>
<h2>Adding libraries</h2>
<p>If you need to add any libraries, just place the swc files in the lib folder and they will be included, the build.xml can be changed if this isn&#8217;t satisfactory.</p>
<h2>Afterword</h2>
<p>I only wanted to get started with papervision, but found it a bit of hassle to get started, hopefully this post will help people get started quickly.</p>
<h2>Acknowledgements</h2>
<p>The ant build file is by no means my own, owes inspiration to previous ant files I&#8217;ve known, including the pyAMF one and information available on the web.</p>
<p>This blog entry: http://talsma.tv/post.cfm/ant-mxmlc-and-swc-files for the info on how to include swc files.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stuartaxon.com/2008/11/29/flex-for-developers-bootstrapping/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

