<?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>Tyler Egeto</title>
	<atom:link href="http://blog.tyleregeto.com/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.tyleregeto.com</link>
	<description>Flash Actionscript Canadian Developer</description>
	<lastBuildDate>Mon, 08 Mar 2010 17:20:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Fall&#8217;n Blocks</title>
		<link>http://blog.tyleregeto.com/archives/523</link>
		<comments>http://blog.tyleregeto.com/archives/523#comments</comments>
		<pubDate>Mon, 08 Mar 2010 04:02:37 +0000</pubDate>
		<dc:creator>Tyler Egeto</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.tyleregeto.com/?p=523</guid>
		<description><![CDATA[Fall&#8217;n Blocks is a Tetris-like game (you can&#8217;t call it Tetris, for obvious reasons) written in AS3. This is just for fun, no real motive behind it. And of course, the source is included below. Have fun!

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_FallnBlocks_407045900"
			class="flashmovie"
			width="500"
			height="465">
	<param name="movie" value="http://tyleregeto.com/flash/FallnBlocks.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://tyleregeto.com/flash/FallnBlocks.swf"
			name="fm_FallnBlocks_407045900"
			width="500"
			height="465">
	<!--<![endif]-->
		


	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
Get the source.
A note about the code: The source code is by no [...]]]></description>
			<content:encoded><![CDATA[<p>Fall&#8217;n Blocks is a Tetris-like game (you can&#8217;t call it Tetris, for obvious reasons) written in AS3. This is just for fun, no real motive behind it. And of course, the source is included below. Have fun!</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_FallnBlocks_997518131"
			class="flashmovie"
			width="500"
			height="465">
	<param name="movie" value="http://tyleregeto.com/flash/FallnBlocks.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://tyleregeto.com/flash/FallnBlocks.swf"
			name="fm_FallnBlocks_997518131"
			width="500"
			height="465">
	<!--<![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><a href="http://tyleregeto.com/code/FallnBlocksAS3.rar">Get the source.</a></p>
<p>A note about the code: The source code is by no means the cleanest, nor is it the best implementation. This was a fun project exploring a few areas of personal interest. It&#8217;s not the worst, but be warned. (and have fun with it)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tyleregeto.com/archives/523/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using vars in regular expressions (AS3)</title>
		<link>http://blog.tyleregeto.com/archives/496</link>
		<comments>http://blog.tyleregeto.com/archives/496#comments</comments>
		<pubDate>Tue, 23 Feb 2010 05:39:50 +0000</pubDate>
		<dc:creator>Tyler Egeto</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Tip]]></category>

		<guid isPermaLink="false">http://blog.tyleregeto.com/?p=496</guid>
		<description><![CDATA[Here&#8217;s a quick tip that you can file under &#8220;good to know.&#8221;
I typically end up using regex&#8217;s at some point in most projects. Anything with user input is pretty much a guarantee. Recently when adding some new functionality to a strip tags util I came across a situation I&#8217;ve never encounter before in ActionScript. As [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick tip that you can file under &#8220;good to know.&#8221;</p>
<p>I typically end up using regex&#8217;s at some point in most projects. Anything with user input is pretty much a guarantee. Recently when adding some new functionality to a strip tags util I came across a situation I&#8217;ve never encounter before in ActionScript. As the title suggests I wanted to use a variable value in the expression, while this isn&#8217;t typically an issue, I came a across a situation where it didn&#8217;t work. Here is the real world example.</p>
<p>Original regex<sup>1</sup>:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/&lt;(&quot;[^&quot;]*&quot;|'[^']*'|[^'&quot;&gt;])*&gt;/ig</div></div>
<p>This nifty expression works like a charm. But I wanted to update it so the developer could limit which tags it stripped to those specified in a array. Pretty straight forward stuff, to use a variable value in a regex you first need to build it as a string and then convert it. Something like the following:</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">exp</span>:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">'start-exp'</span> + someVar + <span style="color: #ff0000;">'more-exp'</span>;<br />
<span style="color: #000000; font-weight: bold;">var</span> regex:Regexp = <span style="color: #000000; font-weight: bold;">new</span> RegExp<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">exp</span><span style="color: #66cc66;">&#41;</span>;</div></div>
<p>Pretty straight forward. So when approaching this small upgrade, that&#8217;s what I did. Of course one big problem was pretty clear.</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">exp</span>:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">'/&lt;'</span> + tag + <span style="color: #ff0000;">'(&quot;[^&quot;]*&quot;|'</span><span style="color: #66cc66;">&#91;</span>^<span style="color: #ff0000;">']*'</span><span style="color: #66cc66;">|</span><span style="color: #66cc66;">&#91;</span>^<span style="color: #ff0000;">'&quot;&gt;])*&gt;/'</span>;</div></div>
<p>Guess what, invalid string! Better escape those quotes in the string. Whoops, that will break the regex! I was stumped. So I opened up the <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/RegExp.html">language reference</a> to see what I could find. The &#8220;source&#8221; parameter, (which I&#8217;ve never used before,) caught my eye. It returns a String described as &#8220;the pattern portion of the regular expression.&#8221; It did the trick perfectly. Here is the solution:</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">start</span>:Regexp = <span style="color: #66cc66;">/&lt;/</span>;<br />
<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">end</span>:Regexp = <span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;[^&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">*</span><span style="color: #ff0000;">&quot;|'[^']*'|[^'&quot;</span><span style="color: #66cc66;">&gt;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*&gt;/</span>ig;<br />
<span style="color: #000000; font-weight: bold;">var</span> complete:RegExp = <span style="color: #000000; font-weight: bold;">new</span> RegExp<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">start</span>.<span style="color: #006600;">source</span> + tag + <span style="color: #0066CC;">end</span>.<span style="color: #006600;">source</span><span style="color: #66cc66;">&#41;</span>;</div></div>
<p>You can reduce it down to this for convenience:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">var complete:RegExp = new RegExp(/&lt;/.source + tag + /(&quot;[^&quot;]*&quot;|'[^']*'|[^'&quot;&gt;])*&gt;/.source, 'ig');</div></div>
<p>Anyways, put that away into the old memory bank, it might come in handy.</p>
<p><small><sup>1</sup>Original expression from <a href="http://www.amazon.ca/exec/obidos/ASIN/0596002890/codinghorror-20">Mastering Regular Expressions</a>, by Jeffrey E.F. Friedl</small></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tyleregeto.com/archives/496/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Anatomy of a change request</title>
		<link>http://blog.tyleregeto.com/archives/458</link>
		<comments>http://blog.tyleregeto.com/archives/458#comments</comments>
		<pubDate>Sat, 20 Feb 2010 23:22:41 +0000</pubDate>
		<dc:creator>Tyler Egeto</dc:creator>
				<category><![CDATA[Project Managment]]></category>

		<guid isPermaLink="false">http://blog.tyleregeto.com/?p=458</guid>
		<description><![CDATA[Steve McConnell sets up the dream perfectly:
With stable requirements, a project can proceed from architecture to design to coding to testing in a way that&#8217;s orderly, predictable, and calm.1
Of course anyone who has worked on anything knows this is exactly that, a dream. (He agrees) Changes are inevitable. They happen for a variety of reasons, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.stevemcconnell.com/">Steve McConnell</a> sets up the dream perfectly:</p>
<blockquote><p>With stable requirements, a project can proceed from architecture to design to coding to testing in a way that&#8217;s orderly, predictable, and calm.<sup>1</sup></p></blockquote>
<p>Of course anyone who has worked on anything knows this is exactly that, a dream. (He agrees) Changes are inevitable. They happen for a variety of reasons, and almost always<sup>2</sup> results in a better end product. You know they are going to happen, so you you need to plan for them from the start. You should have a change procedure clearly outline with the client, and account for them in the initial budget. Here&#8217;s why:</p>
<p><strong>A project change that takes 8 hours for a developer to implement, can easily require 16 man hours from a project budget, and cause a 5 day disruption in the production schedule.</strong></p>
<p>Whoa! What? That&#8217;s right. Changes aren&#8217;t limited to the time a developer spends implementing, it can affect a big chunk of the production. Budget needs to be set aside for handling requests, because even if the change never gets implemented, there is a cost associated with it. Before you can budget for it, you need to understand it. Lets look at the anatomy of a change request.</p>
<p><strong>1. A problem is flagged.</strong><br />
Change requests always begin with a problem being identified. Problems vary greatly, from &#8220;User flow is confusing&#8221; to &#8220;We forgot about X, which our funding requires.&#8221; These can originate from the client or internally.</p>
<p><strong>2. Communication</strong><br />
Once a problem has been flagged, all stake holders need to be updated on the situation. This happens through emails, phone calls, and meetings (internal and external). If a developer is currently build what has been flagged, they may need to stop and wait for a solution.</p>
<p><strong>3. Exploration</strong><br />
Once everyone agrees that the problem is legitimate, and a solution needs to be found, options need to be explored. This can be anything from a meeting to user-flow diagrams and wireframes, there might be prototyping and multiple explorations. The bigger the change, the longer this will take.</p>
<p><strong>4. Spec out the solution</strong><br />
Once a solution has been found it needs to be spec&#8217;d out for everyone. This should be in the form of a document that a client can sign off on and the developer can use to build from. It should clearly out line the problem, solution, and affect on the project cost/schedule. </p>
<p><strong>5. Approval</strong><br />
Approvals typically have turn around time to them where everything is in limbo. Nothing can be done between the time the spec is sent out till approval. Typically there is a fair bit communication that happens here as everyone makes sure they understand the changes. This step will have one of 3 outcomes</p>
<ol>
<li>Approval, production can continue</li>
<li>Proposal is rejected, modify or go back to step 2.</li>
<li>Client decides the change is out of scope/budget. Continue with the original plan, flag for future change.</li>
</ol>
<p><strong>6. Implementation</strong><br />
The process doesn&#8217;t end with approval, the team now must make the change. This means undoing any of the original implementation that has changed, and then building what&#8217;s new.</p>
<p><strong>7. Test</strong><br />
Testing! Every change needs to undergo rigorous testing. Is it a web based application? You need to test in all supported browsers/versions. </p>
<p><strong>8. Bug fixing</strong><br />
Changes introduce new bugs. When you fix a bug you have 20-50% chance of introducing a new one.<sup>3</sup>  For every bug fix you&#8217;ll need to retest all the browsers.</p>
<p>Even if the change doesn&#8217;t go through, there is a cost attached to it. You need to stop productivity and spend man hours before you can even decide if there is going to be a change. If there is, you might add additional cost to the project, if not it falls into just part of the production process.</p>
<p>This will happen to some degree on every project, so you need to account for it. Both in your time line and budget.</p>
<p><small><sup>1</sup> Steve McConnell, Code Complete &#8211; Second Edition, page 39</small><br />
<small><sup>2</sup> I&#8217;ve worked on projects where changes happen for the wrong reasons. Internal disputes, lack of experience, &#8220;absolute&#8221; orders from higher up, have all caused changes for the the wrong reasons leaving the end user to suffer. Sometimes you have to bite the bullet, but you don&#8217;t have to work with the client again.</small><br />
<small><sup>3</sup> Stat from The Mythical Man-Month, page 122, 1995 print</small></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tyleregeto.com/archives/458/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>We all suck at search</title>
		<link>http://blog.tyleregeto.com/archives/445</link>
		<comments>http://blog.tyleregeto.com/archives/445#comments</comments>
		<pubDate>Sat, 30 Jan 2010 05:00:58 +0000</pubDate>
		<dc:creator>Tyler Egeto</dc:creator>
				<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://blog.tyleregeto.com/?p=445</guid>
		<description><![CDATA[I suck at search, YOU suck at search, everyone sucks at search. Accept it. (unless your the Google bot indexing this page) YOUR sucky search skills are killing usability on the web! But it&#8217;s ok, there are people who don&#8217;t suck, and they&#8217;ll let you drink the kool-aid for free.
I recently updated this site to [...]]]></description>
			<content:encoded><![CDATA[<p>I suck at search, YOU suck at search, everyone sucks at search. Accept it. <span style="color: #808080;"><small><em>(unless your the <a href="http://en.wikipedia.org/wiki/Googlebot">Google </a>bot indexing this page)</em></small><span style="color: #000000;"> </span><span style="color: #000000;">YOUR sucky search skills are <em>killing </em><em>usability on the web!</em> But it&#8217;s ok, there are <a href="http://google.ca">people</a> who don&#8217;t suck, and they&#8217;ll let you drink the kool-aid for free.</span></span></p>
<p><span style="color: #808080;"><span style="color: #000000;">I recently updated this site to use <a href="http://www.google.com/cse/">Google Custom Search</a>. It took me 5 minutes to setup<em>, </em>and<em> </em>now anyone can search for all the <a href="http://blog.tyleregeto.com/search-results?cx=016949888620021770111%3A9btd_4nfvgs&amp;cof=FORID%3A11&amp;ie=UTF-8&amp;q=everything+that+rocks&amp;sa=Search&amp;siteurl=blog.tyleregeto.com%252F#223">everthing that rocks</a> on this site. </span></span>I was so impressed I recommended it for a client project, now their search doesn&#8217;t suck either.</p>
<p>It actually gives you quite a bit of style control. You&#8217;ve got full CSS control over the search box (minus a little bit of Google branding), plus color/font choices on the results page, which you can display in site. Sure the Google results page isn&#8217;t the prettiest thing you&#8217;ve seen, but it&#8217;s usable, fast, and familiar to your audience (no matter who they are.)</p>
<p>If you need more control, you can upgrade to their very reasonable <a href="http://www.google.com/sitesearch/">paid service</a>. It&#8217;ll take years for the cost of the basic plan to reach what it&#8217;ll cost you to pay a developer to build you a bad search system. And by that time you&#8217;ll probably be 2 site revisions down the road and still have crappy search. So go for it, admit that you suck, and give your users something they can actually use. I&#8217;ll be doing it whenever I can.</p>
<p>Now if we could just stop people from using IE.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tyleregeto.com/archives/445/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Logger Released</title>
		<link>http://blog.tyleregeto.com/archives/398</link>
		<comments>http://blog.tyleregeto.com/archives/398#comments</comments>
		<pubDate>Tue, 29 Sep 2009 01:16:15 +0000</pubDate>
		<dc:creator>Tyler Egeto</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>

		<guid isPermaLink="false">http://blog.tyleregeto.com/?p=398</guid>
		<description><![CDATA[Continuing the effort to clean up some of my code, I&#8217;ve just added a logging system to my open source code, found on the code page. This logger is designed to be easy to use, Flexible, and extendable. It uses writer objects to handle the message logging. Writers can be added or removed at anytime [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing the effort to clean up some of my code, I&#8217;ve just added a logging system to my open source code, found on the <a href="http://blog.tyleregeto.com/?page_id=58">code page</a>. This logger is designed to be easy to use, Flexible, and extendable. It uses writer objects to handle the message logging. Writers can be added or removed at anytime to change what types of log outputs you want, without modifying the actual log calls. Here is a quick rundown of the key features:</p>
<ul>
<li>Flexible writer model enables multiple logging types/targets</li>
<li>Log filtering system</li>
<li>Very extendable</li>
<li>Instance based, not Singleton <em>(the source of all evil AKA <a title="Lord of the Sith" href="http://en.wikipedia.org/wiki/Darth_Vader">Darth Vader</a>)</em></li>
<li>Singleton wrapper for <em>Vader loven&#8217;</em> developers</li>
<li>Written entirely in ActionScript 3 for usage in Flex and Flash projects</li>
</ul>
<p>With this release I&#8217;m also doing some new things that I will be carrying into future code releases as well. These are:</p>
<p><strong>Unit Tests</strong><br />
I will be including my unit tests from now on. Because of the nature of unit tests (simple, clear, and to the point) they make for excellent usage examples that cover all aspects of a code base.</p>
<p><strong>Formal Documentation</strong><br />
I will be releasing more formal documentation from now on. This will include more detailed information, including topics on usage and extending. It should make the code more accessible. <a href="http://tyleregeto.com/code/logger/">Click here to see the ones included in the logger.</a></p>
<p><strong>More Focused ASDocs</strong><br />
I&#8217;ve included ASDocs in the past, and will continue to do so. These will be focused on what they really are, (which is a language reference), and will not include anything beyond that.</p>
<p>If you find it useful, and create some custom writers or filters please share!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tyleregeto.com/archives/398/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Titanium Chef Live!</title>
		<link>http://blog.tyleregeto.com/archives/382</link>
		<comments>http://blog.tyleregeto.com/archives/382#comments</comments>
		<pubDate>Sun, 27 Sep 2009 19:21:50 +0000</pubDate>
		<dc:creator>Tyler Egeto</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Papervision3D]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://blog.tyleregeto.com/?p=382</guid>
		<description><![CDATA[I&#8217;ll be doing some more posts in the future about this project, but I wanted to put up a quick note about it. Titanium Chef is an Flash Based role playing game that we (mod7) have been developing with the BC Dairy Foundation. The game will run 6-10 hours in length, features fantastic artwork, an [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll be doing some more posts in the future about this project, but I wanted to put up a quick note about it. Titanium Chef is an Flash Based role playing game that we (<a href="http://mod7.com/">mod7</a>) have been developing with the <a href="http://www.bcdairyfoundation.ca/">BC Dairy Foundation</a>. The game will run 6-10 hours in length, features fantastic artwork, an engaging story, awesome sound, and subtle humour that spanes across a wide range of ages.</p>
<p>On both a technical and production quality level, this game is impressive. It breaks the notion that Flash based games need to be quick, simple, &#8220;casual&#8221; experinces. </p>
<p>I highly encourage you to check it out at <a href="http://titaniumchef.ca/">titaniumchef.ca</a></p>
<p>Here are a couple in game screens:</p>
<p><img alt="" src="http://titaniumchef.ca/images/uploads/screenshot6.png" title="Titanium CHef" class="alignnone" width="478" height="282" /></p>
<p><img alt="" src="http://titaniumchef.ca/images/uploads/screenshot2.png" title="Titanium CHef" class="alignnone" width="478" height="282" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tyleregeto.com/archives/382/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Object lifetime, performance, and application design.</title>
		<link>http://blog.tyleregeto.com/archives/335</link>
		<comments>http://blog.tyleregeto.com/archives/335#comments</comments>
		<pubDate>Sun, 05 Jul 2009 17:52:24 +0000</pubDate>
		<dc:creator>Tyler Egeto</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Design patterns]]></category>

		<guid isPermaLink="false">http://blog.tyleregeto.com/?p=335</guid>
		<description><![CDATA[Dear reader, this is one of those posts where a lot of readers might be fully educated, however while working with other developers and with various opensource projects, this is an area that repeatedly pops-up as being neglected. Additionally it&#8217;s not a topic often seen in books or on the web, especially the popular ActionScript [...]]]></description>
			<content:encoded><![CDATA[<p class="authornote"><em><strong>Dear reader</strong>, this is one of those posts where a lot of readers might be fully educated, however while working with other developers and with various opensource projects, this is an area that repeatedly pops-up as being neglected. Additionally it&#8217;s not a topic often seen in books or on the web, especially the popular ActionScript resources, so I feel compelled to begin addressing the topic here. I encourage you to contribute additional points and/or suggestions in the comments.</em></p>
<p>We constantly deal with object lifetimes when we are developing our applications. Evidence of this is making sure we clear all references to an object so it can be cleaned up by the garbage collector. However object lifetime should play a much bigger role in the design of an application then that, and as a result deserves more attention then it gets. In this article we will look at what object lifetime means on a technical level, and then the role it plays in performance and application design.</p>
<p>Object lifetime is the length of an object&#8217;s existence in an application. Technically speaking, from when memory is allocated (reserved) for the object until it is deallocated (freed for re-use). This process is handled for us in ActionScript, but occurs based on our actions. For example when we use the keyword &#8220;new&#8221; memory is allocated for the object we are creating, and when the garbage collector cleans it up that memory is deallocated.</p>
<p>Based on the previous definition, we can look at our Flash applications in terms of lifetime. The Stage has a lifetime at the application level, meaning it exists as long as the application is running. An array that contains references to all the children in a DisplayObjectContainer has a instance level lifetime, so it will exist as long as the DisplayObjectContainer exists. Other object&#8217;s lifetime may be limited to a method call.</p>
<p>Often developers have objects who&#8217;s lifetimes are too long. I believe a it stems from a number of places, but based on work with other developers a few key place are:</p>
<ul>
<li>the knowledge that object creation is expensive</li>
<li>a lack of formal programming theory, particularly <a href="http://en.wikipedia.org/wiki/Design_pattern_(computer_science)" target="_blank">Design Patterns</a>, which offers tools for dealing with application design</li>
<li>Insufficient focus on the topic in popular resources</li>
</ul>
<p>Object creation in ActionScript is expensive, <strong>but</strong> so is keeping unneeded objects in memory. Managing object lifetimes in an application means creating and destroying objects as needed, allowing us to keep the application running at an optimal speed while using minimum resources.</p>
<p>Take for example a Flash website where all the major sections are created at application initialization. (which puts them all into application level lifetime.) Changing a section simply means changing the visibility property, or adding/removing display objects from the display list. The result is that the entire site is kept in memory all the time, regardless of if the user ever visits each section.</p>
<p>The truth is, that for many Flash sites, &#8220;micro sites&#8221; for example, you could argue this just doesn&#8217;t matter. Doing things differently would result in unnoticeable performance improvements on most modern computers, and the end user would not know the difference. This changes however with one particular changing/new (certainly new growth) market that is going to be huge for Flash, that market is cellphones. <a href="http://www.adobe.com/devnet/devices/articles/htchero.html" target="_blank">Cellphones are now starting to to have full Flash support</a>, and we&#8217;re not talking about Flash light, but <em>full </em>Player 10 support. Suddenly that little bit of memory counts for a lot more.</p>
<p>So how else could you construct your site? The simple solution is to construct the sections as the user requests them, and destroy them when they leave them. You&#8217;re navigation might be at an application level lifetime, but each page need not be. What about the expense of creating new instances? Changing the section is a limited action, only happening on a user action, so it will not occur at a high rate of speed or necessarily at all, and therefore is not a issue. It becomes cheaper to build on demand and not maintain in memory for reuse. There are several design patterns to assist in the creation of objects, for example the <a href="http://en.wikipedia.org/wiki/Factory_method_pattern">Factory Method</a>.</p>
<p>Looking at another example in a different situation, lets take a general button that offers several methods and properties for styling it, one of which is a label and another is an optional display object to use as an icon. The button uses a TextField object for displaying the label.</p>
<p>A common way of building this button would be to create a TextField in the constructor, add it to the display list, and maintain a reference to it through a private variable for changing the text displayed. The problem with this is that there will be situations where a button has no label, (an empty string), perhaps it&#8217;s strictly icon based instead. In this case you still have a TextField object in memory that you are not using, that&#8217;s one for each button instance, so potentially lots of them.  So our label TextField lifetime should not be the same as our button&#8217;s lifetime. When the label is set, the function handling that process should determine if it needs to create, dispose, or update the TextField object. Construction is not a performance issue because likely the label will only be set once, or not at all.</p>
<p>By paying attention to object lifetime in the design/construction of your application, and keeping objects in the proper lifetime scope, you can gain significant performance increases, especially as the application grows in size, or when targeting power limited devices. While this article only looks at specific examples, this is a topic that applies to every piece of you application, and as a result should be fully considered throughout the construction process. I&#8217;ll be exploring this topic more in future posts.</p>
<p><strong>additional resources:</strong></p>
<p><a href="http://misko.hevery.com/2009/04/15/managing-object-lifetimes/">Managing Object Lifetimes, by Miško Hevery</a></p>
<p><a href="http://www.as3dp.com/" target="_blank">ActionScript3 Design Patterns, Bill Sanders &amp; Chandima Cumaranatunge</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tyleregeto.com/archives/335/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Paginator AS3 version 0.6.0</title>
		<link>http://blog.tyleregeto.com/archives/241</link>
		<comments>http://blog.tyleregeto.com/archives/241#comments</comments>
		<pubDate>Sun, 21 Jun 2009 18:07:47 +0000</pubDate>
		<dc:creator>Tyler Egeto</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>

		<guid isPermaLink="false">http://blog.tyleregeto.com/?p=241</guid>
		<description><![CDATA[After working more with Paginator AS3 on client projects I&#8217;ve added a couple of new features to the pagination object and fixed a few minor bugs. The following features have been implemented in the latest update, version 0.6.0.

Added lastPage property. Will return the page the pagination object was on before the current one, or zero [...]]]></description>
			<content:encoded><![CDATA[<p>After working more with Paginator AS3 on client projects I&#8217;ve added a couple of new features to the pagination object and fixed a few minor bugs. The following features have been implemented in the latest update, version 0.6.0.</p>
<ul>
<li>Added <em>lastPage</em> property. Will return the page the pagination object was on before the current one, or zero if the page has not changed yet. This is useful for detecting the direction movement.</li>
<li>Added <em>getItemsOnPage(page:int):Array</em> method. Allows access to the information on any page.</li>
</ul>
<p>You can grab the latest version on the <a href="http://blog.tyleregeto.com/?page_id=58">Code page.</a></p>
<p>Version 0.7.0 will feature a simple pagination control view, with the main goal of making prototyping easier.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tyleregeto.com/archives/241/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ActionScript 3 Tooltip</title>
		<link>http://blog.tyleregeto.com/archives/216</link>
		<comments>http://blog.tyleregeto.com/archives/216#comments</comments>
		<pubDate>Fri, 29 May 2009 16:30:34 +0000</pubDate>
		<dc:creator>Tyler Egeto</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>

		<guid isPermaLink="false">http://blog.tyleregeto.com/?p=216</guid>
		<description><![CDATA[I&#8217;ll be releasing more tools and helpers in the near future as I formalize / clean-up my existing code libraries. In addition to the ActionScript pagination system released earlier this month, PaginatorAS3, today I&#8217;m release a small Tooltip system.
Hover over a icon to see it&#8217;s tooltip:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_tooltipDemo_1563473266"
			class="flashmovie"
			width="140"
			height="60">
	<param name="movie" value="http://tyleregeto.com/flash/tooltipDemo.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://tyleregeto.com/flash/tooltipDemo.swf"
			name="fm_tooltipDemo_1563473266"
			width="140"
			height="60">
	<!--<![endif]-->
		


	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
Icons created by Mark [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll be releasing more tools and helpers in the near future as I formalize / clean-up my existing code libraries. In addition to the ActionScript pagination system released earlier this month, <a href="http://blog.tyleregeto.com/?p=183">PaginatorAS3</a>, today I&#8217;m release a small Tooltip system.</p>
<p>Hover over a icon to see it&#8217;s tooltip:</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_tooltipDemo_1347147211"
			class="flashmovie"
			width="140"
			height="60">
	<param name="movie" value="http://tyleregeto.com/flash/tooltipDemo.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://tyleregeto.com/flash/tooltipDemo.swf"
			name="fm_tooltipDemo_1347147211"
			width="140"
			height="60">
	<!--<![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><br />
<small>Icons created by Mark James, <a href="http://www.famfamfam.com/lab/icons/silk/">www.famfamfam.com/lab/icons/silk</a></small></p>
<p>This small library makes adding tooltips to ActionScript based projects really easy. Some key features are:</p>
<ul>
<li>Instance based, not Singleton (as it is in Flex) which allows for multiple instances to exist in a single application.</li>
<li>Objects who have tooltips do not need to know about the display controller</li>
<li>Easily add a tool tip to any custom DisplayObject</li>
</ul>
<p>To add tooltips to an application you need to create an instance of ToolTipController. ToolTipController has two parameters, the first is the root DisplayObjectContainer that you want to find tooltips in, (It will automatically find any tooltip&#8217;s in it&#8217;s display list), and the second is an instance of the IToolTip interface which will handle the tool tip target.</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">var</span> toolTip = <span style="color: #000000; font-weight: bold;">new</span> ToolTip<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #000000; font-weight: bold;">new</span> ToolTipController<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>, toolTip<span style="color: #66cc66;">&#41;</span>;</div></div>
<p>The ToolTipController will look for any objects that implement the IToolTipTarget interface.</p>
<p><a href="http://tyleregeto.com/code/tooltipAS3.rar">You can download it here (with demo)</a><br />
<a href="http://tyleregeto.com/code/docs/">and view the docs here.</a></p>
<p>This is a BETA release, so feel free to offer any feedback.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tyleregeto.com/archives/216/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Paginator AS3</title>
		<link>http://blog.tyleregeto.com/archives/183</link>
		<comments>http://blog.tyleregeto.com/archives/183#comments</comments>
		<pubDate>Sun, 17 May 2009 06:35:03 +0000</pubDate>
		<dc:creator>Tyler Egeto</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>

		<guid isPermaLink="false">http://blog.tyleregeto.com/?p=183</guid>
		<description><![CDATA[I&#8217;ve got a couple projects currently in production that require the pagination of data which has lead to PaginatorAS3. It&#8217;s a small controller/model for paginating data contained in a Array. Pagination seems to pop-up in a lot of ActionScript projects in a variety of forms, so I decided to formalize it into a flexible object. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve got a couple projects currently in production that require the pagination of data which has lead to PaginatorAS3. It&#8217;s a small controller/model for paginating data contained in a Array. Pagination seems to pop-up in a lot of ActionScript projects in a variety of forms, so I decided to formalize it into a flexible object. PaginatorAS3 contains no views, but takes care of all the data management in a clean simple implementation. </p>
<p>To create a new paginator you do the following:</p>
<div class="codecolorer-container actionscript3 mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">paginator = <span style="color: #0033ff; font-weight: bold;">new</span> Paginator<span style="color: #000000;">&#40;</span>myArray<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
<p>Then to retrieve the data set for a page you can do the following:</p>
<div class="codecolorer-container actionscript3 mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">paginator<span style="color: #000066; font-weight: bold;">.</span>getCurrentItems<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
<p>It supports 3 page scrolling types, NONE (see all pages), SLIDING (current page in the middle), and JUMPING (jumps by groups of pages), additionally you can control the number of pages to appear at one time. (NONE ignores this)</p>
<p>Below is a simple demo using the sliding scroll style.<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_paginator_sliding_1622505307"
			class="flashmovie"
			width="500"
			height="150">
	<param name="movie" value="http://tyleregeto.com/flash/paginator_sliding.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://tyleregeto.com/flash/paginator_sliding.swf"
			name="fm_paginator_sliding_1622505307"
			width="500"
			height="150">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p><a href="http://tyleregeto.com/code/PaginatorAS3.rar">Download the source and demo here. (Demo code included)</a><br />
<a href="http://tyleregeto.com/code/paginatordocs/">View the docs here</a></p>
<p>This is a BETA release, so if you try it feel free to offer any feedback.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tyleregeto.com/archives/183/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
