<?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>Dreaming in Flash &#187; Best Practices</title>
	<atom:link href="http://www.dreaminginflash.com/category/best-practices/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dreaminginflash.com</link>
	<description>There is no universally agreed-upon biological definition of dreaming</description>
	<lastBuildDate>Wed, 12 Oct 2011 17:29:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Where is as2 _root in as3?</title>
		<link>http://www.dreaminginflash.com/2008/10/27/where-is-as2-_root/</link>
		<comments>http://www.dreaminginflash.com/2008/10/27/where-is-as2-_root/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 22:08:59 +0000</pubDate>
		<dc:creator>Ivan Valadares</dc:creator>
				<category><![CDATA[Actionscript3]]></category>
		<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.dreaminginflash.com/?p=181</guid>
		<description><![CDATA[If you remember in as2 we had _root which let us access to methods and variables in the root of the project and refer to absolute paths, I thought that as3 didnâ€™t have _root propriety, but I was wrong.  root property can be useful if you want to share some value to all the [...]]]></description>
			<content:encoded><![CDATA[<p>If you remember in as2 we had _root which let us access to methods and variables in the root of the project and refer to absolute paths, I thought that as3 didnâ€™t have _root propriety, but I was wrong.  root property can be useful if you want to share some value to all the classes in the project, add events to main class that call methods declared inside the class where we are working on or call generic methods declare in root class.</p>
<p>To use root propriety the class that you are working on most extend a DisplayObject  (Sprite,MovieCLip,etcâ€¦) because you have to add the class to the parent class. And note, you canâ€™t use the root propriety in the constructor method, because the addChild havenâ€™t been process yet! Well letâ€™s stop writing and see some code:</p>
<p>Main.as<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="400" height="350" id="ftf_wp" align="middle">
		  <param name="movie" value="http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/ftf_wp.swf" />
		  <param name="quality" value="high" />
		  <param name="scale" value="noscale" />
		  <param name="bgcolor" value="#ffffff" />
		  <param name="flashvars" value="w=400&h=350&file=index.php&ftf=true&postID=181&no=0&def=http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/definitions/as2.xml&auto=true&" />
		  <embed src="http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/ftf_wp.swf" quality="high" scale="noscale" bgcolor="#ffffff" width="400" height="350" name="ftf_wp" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="w=400&h=350&file=index.php&ftf=true&postID=181&no=0&def=http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/definitions/as2.xml&auto=true&" />
		</object></p>
<p>In the Main class Iâ€™m declaring a variable named myValue which I did the proper sets and get. I am declaring two classes, in one of them I will set the value at the Main class and in the other I will get that value back. Iâ€™m also creating a movieClip just for test purposes. </p>
<p>ExampleClass.as<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="400" height="350" id="ftf_wp" align="middle">
		  <param name="movie" value="http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/ftf_wp.swf" />
		  <param name="quality" value="high" />
		  <param name="scale" value="noscale" />
		  <param name="bgcolor" value="#ffffff" />
		  <param name="flashvars" value="w=400&h=350&file=index.php&ftf=true&postID=181&no=1&def=http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/definitions/as2.xml&auto=true&" />
		  <embed src="http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/ftf_wp.swf" quality="high" scale="noscale" bgcolor="#ffffff" width="400" height="350" name="ftf_wp" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="w=400&h=350&file=index.php&ftf=true&postID=181&no=1&def=http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/definitions/as2.xml&auto=true&" />
		</object></p>
<p>In ExampleClass Iâ€™m setting myValue that is propriety of the Main class with some text and Iâ€™m tracing the movieClip that I create in the Main Class.</p>
<p>AnotherClass.as<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="400" height="350" id="ftf_wp" align="middle">
		  <param name="movie" value="http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/ftf_wp.swf" />
		  <param name="quality" value="high" />
		  <param name="scale" value="noscale" />
		  <param name="bgcolor" value="#ffffff" />
		  <param name="flashvars" value="w=400&h=350&file=index.php&ftf=true&postID=181&no=2&def=http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/definitions/as2.xml&auto=true&" />
		  <embed src="http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/ftf_wp.swf" quality="high" scale="noscale" bgcolor="#ffffff" width="400" height="350" name="ftf_wp" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="w=400&h=350&file=index.php&ftf=true&postID=181&no=2&def=http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/definitions/as2.xml&auto=true&" />
		</object></p>
<p>In AnotherClass Iâ€™m tracing the myValue propriety. So the result should be:<br />
<code>[object MovieClip]<br />
This value is inside the Main Class</code></p>
<p>So it works ok, you only have to be carefull not refer root inside the constructor method, have the certain that you already addChild the class when you are referring to root and that the class extends a display object. If you do that, you can too have access to stage propriety, letâ€™s check the next example:</p>
<p>ExampleClass.as<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="400" height="350" id="ftf_wp" align="middle">
		  <param name="movie" value="http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/ftf_wp.swf" />
		  <param name="quality" value="high" />
		  <param name="scale" value="noscale" />
		  <param name="bgcolor" value="#ffffff" />
		  <param name="flashvars" value="w=400&h=350&file=index.php&ftf=true&postID=181&no=3&def=http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/definitions/as2.xml&auto=true&" />
		  <embed src="http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/ftf_wp.swf" quality="high" scale="noscale" bgcolor="#ffffff" width="400" height="350" name="ftf_wp" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="w=400&h=350&file=index.php&ftf=true&postID=181&no=3&def=http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/definitions/as2.xml&auto=true&" />
		</object></p>
<p>The result should be or stage width.</p>
<p>Another way to access to main proprieties, methods, etcâ€¦ is with static members. In the next example Iâ€™m declaring a static property in the main class and setting and trace the value of it in the example class.</p>
<p>Main.as<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="400" height="350" id="ftf_wp" align="middle">
		  <param name="movie" value="http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/ftf_wp.swf" />
		  <param name="quality" value="high" />
		  <param name="scale" value="noscale" />
		  <param name="bgcolor" value="#ffffff" />
		  <param name="flashvars" value="w=400&h=350&file=index.php&ftf=true&postID=181&no=4&def=http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/definitions/as2.xml&auto=true&" />
		  <embed src="http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/ftf_wp.swf" quality="high" scale="noscale" bgcolor="#ffffff" width="400" height="350" name="ftf_wp" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="w=400&h=350&file=index.php&ftf=true&postID=181&no=4&def=http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/definitions/as2.xml&auto=true&" />
		</object></p>
<p>ExampleClass.as<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="400" height="350" id="ftf_wp" align="middle">
		  <param name="movie" value="http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/ftf_wp.swf" />
		  <param name="quality" value="high" />
		  <param name="scale" value="noscale" />
		  <param name="bgcolor" value="#ffffff" />
		  <param name="flashvars" value="w=400&h=350&file=index.php&ftf=true&postID=181&no=5&def=http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/definitions/as2.xml&auto=true&" />
		  <embed src="http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/ftf_wp.swf" quality="high" scale="noscale" bgcolor="#ffffff" width="400" height="350" name="ftf_wp" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="w=400&h=350&file=index.php&ftf=true&postID=181&no=5&def=http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/definitions/as2.xml&auto=true&" />
		</object></p>
<p>The result should be â€œHello Word!â€, if you didnâ€™t know this, read some books about object oriented programming and static members.</p>
<p>Another way to do the same thing is to pass the instance of main class as an argument to the other classes. </p>
<p>Main.as<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="400" height="350" id="ftf_wp" align="middle">
		  <param name="movie" value="http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/ftf_wp.swf" />
		  <param name="quality" value="high" />
		  <param name="scale" value="noscale" />
		  <param name="bgcolor" value="#ffffff" />
		  <param name="flashvars" value="w=400&h=350&file=index.php&ftf=true&postID=181&no=6&def=http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/definitions/as2.xml&auto=true&" />
		  <embed src="http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/ftf_wp.swf" quality="high" scale="noscale" bgcolor="#ffffff" width="400" height="350" name="ftf_wp" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="w=400&h=350&file=index.php&ftf=true&postID=181&no=6&def=http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/definitions/as2.xml&auto=true&" />
		</object></p>
<p>Example.as<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="400" height="350" id="ftf_wp" align="middle">
		  <param name="movie" value="http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/ftf_wp.swf" />
		  <param name="quality" value="high" />
		  <param name="scale" value="noscale" />
		  <param name="bgcolor" value="#ffffff" />
		  <param name="flashvars" value="w=400&h=350&file=index.php&ftf=true&postID=181&no=7&def=http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/definitions/as2.xml&auto=true&" />
		  <embed src="http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/ftf_wp.swf" quality="high" scale="noscale" bgcolor="#ffffff" width="400" height="350" name="ftf_wp" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="w=400&h=350&file=index.php&ftf=true&postID=181&no=7&def=http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/definitions/as2.xml&auto=true&" />
		</object></p>
<p>There are still another ways to access to the Main class code. I donâ€™t know which techniques are more correct, I usually use them all depending in what I need. I hope I help someone. <img src='http://www.dreaminginflash.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

]]></content:encoded>
			<wfw:commentRss>http://www.dreaminginflash.com/2008/10/27/where-is-as2-_root/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Frameworks, my take on it</title>
		<link>http://www.dreaminginflash.com/2008/05/20/frameworks-my-take-on-it/</link>
		<comments>http://www.dreaminginflash.com/2008/05/20/frameworks-my-take-on-it/#comments</comments>
		<pubDate>Tue, 20 May 2008 20:13:56 +0000</pubDate>
		<dc:creator>Idoru</dc:creator>
				<category><![CDATA[Actionscript3]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[Articles]]></category>
		<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Cairngorm]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Mate]]></category>
		<category><![CDATA[pureMVC]]></category>

		<guid isPermaLink="false">http://www.dreaminginflash.com/2008/05/20/frameworks-my-take-on-it/</guid>
		<description><![CDATA[Flash and Flex frameworks.
Lately I've working on three big projects that would require the usage of a framework, and not wanting to extend my own framework, that consists mostly of accumulated libraries over time, I decided to give the most prominent ones a go.
So I started by checking out what was on the market, I [...]]]></description>
			<content:encoded><![CDATA[<p>Flash and Flex frameworks.</p>
<p>Lately I've working on three big projects that would require the usage of a framework, and not wanting to extend my own framework, that consists mostly of accumulated libraries over time, I decided to give the most prominent ones a go.</p>
<p>So I started by checking out what was on the market, I found as-hive, pureMVC, Cairngorm and Mate ( there are a few more but somehow I didn't feel they were mature enough to be used.<br />
<span id="more-139"></span><br />
Now for a little background on this quest for the framework, and few of my personal opinions on the whole framework  business.<br />
The point of a framework is to aid you in the making of your application/website, this can be the handling of repetitive tasks for you, providing a strict way of coding and thus giving you a common ground of understanding with your peers. Also it's meant to  enable you to code more efficiently, make your code more readable and produce a scalable product that you can, even at a later date, modify without breaking everything.<br />
What they are NOT meant to do is to force a coding style that makes feel restricted, uncomfortable with and most important they shouldn't be extra work. It feels pretty pointless to have to code 3 times as more to have the same functionality, some of you might immediately argue "but what about scalability?" well sometimes that's not everything, in the real work time matters.</p>
<p>Ok, now that we got that out of the way let's move on to the frameworks.<br />
The project that required me to start first was a PV3D website that heavily relies on dynamic content. So I checked out pureMVC and as-hive and quickly decided to go with pureMVC.<br />
So then I went on to the forums and examples pages and tried to read all that mattered to me, plus I found nice diagrams that help you out alot in the beginning.<br />
As I delved more into the project I realized that some extending and heavy integration of PV3D and pureMVC would be required in order to make things easy for me, plus the project relies on the URL to know where it is and react accordingly, this was easy enough, simple and clear.</p>
<p>So my opinion on pureMVC is that it's the perfect framework for AS3 projects because it's easily extensible, highly functional, doesn't force you to adopt a specific style but still requires you to have rules and standards.</p>
<p>The next project is an AIR Application that will mimic some of the functionality of Powerpoint so I immediately thought of Cairngorm, but then I heard about Mate (pronounced mah-tey) and it seemed like the perfect solution.</p>
<p>So having already started development with Cairngorm when I heard about Mate, it felt like a risk to change, but nevertheless a risk worthwhile taking should Mate be more practical and provide me with a faster environment in which to code.<br />
Well Mate does look great on paper ( and I printed the architecture) but somehow it feels like it still hasn't achieved critical mass to be used, now don't get me wrong it's a great framework and I'm sure that with some extra work I'd be in love with it, but at the moment I just didn't have the time to try and figure out somethings on my own and the forums don't have that many topics, plus the examples are far too simple. So I'm sticking with Cairgnorm for the time being.<br />
Cairgorm is a must know for any Flex developer, it's the official framework which means that plenty of clients will feel more comfortable with ,or even ask for it.</p>
<p>That said I started using Cairngorm and eventually grew to like it, I liked the ViewModelLocator and the self dispatching event model, and it did eventually make my work easier.</p>
<p>And to finalize I'll go into no frameworks at all because sometimes a framework is just an overkill, some might say that it's always the best solution, but not always. Sometimes we just need to develop a small application/website and using a framework is actually extra work than just making it the fastest way possible and if it needs updates after they should be easy enough, if they aren't, well you can always refactor it into a framework based app. This works well for me because of years of accumulated libraries that provide me with most of the common tasks i need, many of them published here on DIF.</p>
<p>So that's enough and if you read all the way here congratulations, and please leave me your thoughts.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.dreaminginflash.com/2008/05/20/frameworks-my-take-on-it/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Swc Image problems</title>
		<link>http://www.dreaminginflash.com/2008/03/06/swc-image-problems/</link>
		<comments>http://www.dreaminginflash.com/2008/03/06/swc-image-problems/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 20:34:54 +0000</pubDate>
		<dc:creator>Ivan Valadares</dc:creator>
				<category><![CDATA[Actionscript3]]></category>
		<category><![CDATA[Best Practices]]></category>

		<guid isPermaLink="false">http://www.dreaminginflash.com/2008/03/06/swc-image-problems/</guid>
		<description><![CDATA[Last month I had to run one image sequence with 100 images, so I create a new movie in flash, put every image in every frame, image1 to frame1, image2 to frame2, etc. It ran ok in flash but when I exported it to flex (SWC format) the problem began. Every time I did some [...]]]></description>
			<content:encoded><![CDATA[<p>Last month I had to run one image sequence with 100 images, so I create a new movie in flash, put every image in every frame, image1 to frame1, image2 to frame2, etc. It ran ok in flash but when I exported it to flex (SWC format) the problem began. Every time I did some modifications to one of the SWC files in the project it started to delay 15 minutes to build. So be careful with the number of images inside a SWC file, it can be very boring.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.dreaminginflash.com/2008/03/06/swc-image-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Actionscript Class Comments</title>
		<link>http://www.dreaminginflash.com/2007/12/20/actionscript-class-comments/</link>
		<comments>http://www.dreaminginflash.com/2007/12/20/actionscript-class-comments/#comments</comments>
		<pubDate>Thu, 20 Dec 2007 19:18:49 +0000</pubDate>
		<dc:creator>nuno</dc:creator>
				<category><![CDATA[Actionscript3]]></category>
		<category><![CDATA[Best Practices]]></category>

		<guid isPermaLink="false">http://www.dreaminginflash.com/2007/12/20/actionscript-class-comments/</guid>
		<description><![CDATA[I've been gathering some guidelines to writing proper class documentation in Actionscript. This is so basic stuff but anyway it helps to have it written down somewhere. Here's what I have so far as general guidelines:

Use ASDoc block comments (Ctrl+Shift+D in Flex Builder).
Write in English.
Use a $Id$ svn/cvs keyword so everyone knows directly who did [...]]]></description>
			<content:encoded><![CDATA[<p>I've been gathering some guidelines to writing proper class documentation in Actionscript. This is so basic stuff but anyway it helps to have it written down somewhere. Here's what I have so far as general guidelines:</p>
<ul>
<li>Use ASDoc block comments (Ctrl+Shift+D in Flex Builder).</li>
<li>Write in English.</li>
<li>Use a $Id$ svn/cvs keyword so everyone knows directly who did the last change on the file.</li>
<li>If importing to COM, write an example of usage.</li>
<li>Favor the use of getters and setters instead of public vars/const.</li>
<li>In the source code use the following order to keep things organized:</li>
</ul>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="500" height="300" id="ftf_wp" align="middle">
		  <param name="movie" value="http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/ftf_wp.swf" />
		  <param name="quality" value="high" />
		  <param name="scale" value="noscale" />
		  <param name="bgcolor" value="#ffffff" />
		  <param name="flashvars" value="=&file=index.php&ftf=true&postID=61&no=0&def=http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/definitions/as2.xml&auto=true&" />
		  <embed src="http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/ftf_wp.swf" quality="high" scale="noscale" bgcolor="#ffffff" width="500" height="300" name="ftf_wp" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="=&file=index.php&ftf=true&postID=61&no=0&def=http://www.dreaminginflash.com/wp-content/plugins/FlashTextFormatter/definitions/as2.xml&auto=true&" />
		</object></p>

]]></content:encoded>
			<wfw:commentRss>http://www.dreaminginflash.com/2007/12/20/actionscript-class-comments/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

