<?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>zedia flash blog &#187; ActionScript projects</title>
	<atom:link href="http://www.zedia.net/tag/actionscript-projects/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zedia.net</link>
	<description>Flash, ActionScript, SEO and everything in between</description>
	<lastBuildDate>Wed, 21 Jul 2010 17:07:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Compile time variables in Flash Develop</title>
		<link>http://www.zedia.net/2009/compile-time-variables-in-flash-develop/</link>
		<comments>http://www.zedia.net/2009/compile-time-variables-in-flash-develop/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 19:00:34 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[FlashDevelop]]></category>
		<category><![CDATA[ActionScript projects]]></category>
		<category><![CDATA[Compile-time variables]]></category>
		<category><![CDATA[Conditional compilation]]></category>
		<category><![CDATA[Flash Develop]]></category>
		<category><![CDATA[Flex Compiler]]></category>

		<guid isPermaLink="false">http://www.zedia.net/?p=482</guid>
		<description><![CDATA[That is something that I have been wanting for a long time but I just found out how to do it. So what is a compile time variable? It is a variable that you can do conditions on at compile time (if) and the compiler will only include a set of lines in the resulting [...]]]></description>
			<content:encoded><![CDATA[<p>That is something that I have been wanting for a long time but I just found out how to do it.</p>
<h3><strong>So what is a compile time variable?</strong></h3>
<p>It is a variable that you can do conditions on at compile time (if) and the compiler will only include a set of lines in the resulting swf. This can be usefull for debugging purpose or when you have multiple languages or versions in a site. Let&#8217;s look at an example:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>CONFIG::LANG == <span style="color: #ff0000;">&quot;en&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
  _pageHolder = <span style="color: #000000; font-weight: bold;">new</span> PageHolderEn<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
  _pageHolder = <span style="color: #000000; font-weight: bold;">new</span> PageHolderFr<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>In the previous code, if the compile time variable CONFIG::LANG is equal to &#8220;en&#8221;, than the line &#8220;_pageHolder = new PageHolderEn();&#8221; will be included in the final swf, otherwise it will be the other line. You can give a Boolean, int and String value (and probably other types too) to the variable.</p>
<h3>So how do you set the value of that compile time variable?</h3>
<p>Well there are a couple of examples out there about how to do so in <a title="Compile time variables in Flash" href="http://summitprojectsflashblog.wordpress.com/2008/10/11/compile-time-variables/" target="_blank">Flash CS4 IDE</a> or in <a title="Conditional compilation in Flex" href="http://permadi.com/wordpress2/?p=27" target="_blank">Flash(Flex) Builder</a>, but none in Flash Develop so that is what I am going to explain here. First if you do this in Flash Develop, it means you are either doing a Flex project or an ActionScript project (meanin you are compiling with the Flex compiler (is it still named like this?)). So once you have created your project, go in the Project Properties and in the Compiler Options tab, look for the Additional Compiler Options. Here is a screenshot of what it looks like:</p>
<p><img class="aligncenter size-full wp-image-483" title="compile-time" src="http://www.zedia.net/wp-content/uploads/2009/10/compile-time.jpg" alt="compile-time" width="372" height="414" /></p>
<p>What you need to add in there is this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">-define+=CONFIG::LANG,<span style="color: #ff0000;">&quot;en&quot;</span></pre></div></div>

<p>Where CONFIG::LANG is your variable name and &#8220;en&#8221; is the value as a String.  For the variable name it seems to always be starting with CONFIG::, I don&#8217;t know if that is a convention or if that is needed so that the compiler knows its a compile time variable. I will need to do more reasearch on this. If you wanted to set the variable to a boolean you&#8217;d do this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">-define+=CONFIG::LANG,<span style="color: #000000; font-weight: bold;">true</span></pre></div></div>

<p>And same principle for a int, you&#8217;d put just the number without the quotes.</p>
<p>Now in Flash Develop, the project properties are stored in a file with the .as3proj extention so if you don&#8217;t want to have to change the Additional Conpiler Option you can just copy the project file and rename it. In the new file change the compile time value and depending how you want to compile, you open the right project file.</p>
<p>Well, it&#8217;s as simple as this.</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.zedia.net%2F2009%2Fcompile-time-variables-in-flash-develop%2F&amp;layout=standard&amp;show-faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:550px; height:70px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2009/compile-time-variables-in-flash-develop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PureMVC Skeleton for ActionScript projects</title>
		<link>http://www.zedia.net/2009/puremvc-skeleton-for-actionscript-projects/</link>
		<comments>http://www.zedia.net/2009/puremvc-skeleton-for-actionscript-projects/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 16:08:42 +0000</pubDate>
		<dc:creator>zedia.net</dc:creator>
				<category><![CDATA[PureMVC]]></category>
		<category><![CDATA[ActionScript projects]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PureMVC Skeleton]]></category>
		<category><![CDATA[PureMVC Skeleton for ActionScript projects]]></category>

		<guid isPermaLink="false">http://www.zedia.net/?p=434</guid>
		<description><![CDATA[I had previously done a PureMVC skeleton for Flash websites and applications, meaning that you would use the Flash IDE compiler to compile your project. Lately I have been doing more and more ActionScript projects (compiled using the Flex compiler but not using the Flex framework) because it permits the separation of big FLAs into [...]]]></description>
			<content:encoded><![CDATA[<p>I had previously done a <a title="PureMVC Skeleton for Flash Applications / Websites" href="http://www.zedia.net/2009/puremvc-skeleton-for-flash-applications-websites/" target="_self">PureMVC skeleton for Flash websites and applications</a>, meaning that you would use the Flash IDE compiler to compile your project. Lately I have been doing more and more ActionScript projects (compiled using the Flex compiler but not using the Flex framework) because it permits the separation of big FLAs into smaller ones thus facilitating working in team. But I had no template/skeleton to start with until now.</p>
<p>So here it is:</p>
<p><a title="PureMVC ActionScript Project Skeleton" href="http://zedia.net/files/PureMVC_ActionScript_Project_Skeleton.rar">PureMVC ActionScript Project Skeleton</a></p>
<p>It still uses an external preloader and I added a local Boolean so that the application knows your are testing locally and not on the sever (useful when making server call). One of the major change is the inclusion of the SharedAssetLibrary. Basically this emulate having one FLA with all graphics and MovieClip, but you actually can have multiple FLAs. When you want to add something to the SharedAssetLibrary you first add it to a FLA, set it to Export for ActionScript and then compile it to the swf folder. Then you can add it in the SharedAssetLibrary using the embed statment:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">//BackgroundAsset being the name you gave it in the library</span>
&nbsp;
<span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">&quot;../../../swf/Background.swf&quot;</span>, symbol=<span style="color: #ff0000;">&quot;BackgroundAssets&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> BackgroundAssets:<span style="color: #000000; font-weight: bold;">Class</span>;</pre></div></div>

<p>Now if you want to use this in any of your views, first import SharedAssetLibrary and than you can use it like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> BackgroundAssets:<span style="color: #000000; font-weight: bold;">Class</span> = SharedAssetsLibrary.<span style="color: #006600;">getInstance</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getAsset</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;BackgroundAssets&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> assets:<span style="color: #66cc66;">*</span> = <span style="color: #000000; font-weight: bold;">new</span> BackgroundAssets<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span>Sprite<span style="color: #66cc66;">&#40;</span>assets<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>I included a FlashDevelop project file in there, but you can just delete it if you use Flash Builder.</p>
<p>Using a skeleton greatly reduce the setup time of a project, so I hope this will help you. I want to look into doing a skeleton for Flex Application, because I don&#8217;t like the <a title="PureMVC Flex application skeleton" href="http://trac.puremvc.org/Demo_AS3_Flex_AppSkeleton" target="_blank">skeleton</a> that is available on the <a title="PureMVC" href="http://puremvc.org/" target="_blank">PureMVC</a> website.</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.zedia.net%2F2009%2Fpuremvc-skeleton-for-actionscript-projects%2F&amp;layout=standard&amp;show-faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:550px; height:70px;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.zedia.net/2009/puremvc-skeleton-for-actionscript-projects/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
