<?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"
	>

<channel>
	<title>Automata</title>
	<atom:link href="http://www.automatastudios.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.automatastudios.com</link>
	<description></description>
	<pubDate>Fri, 21 Nov 2008 18:45:00 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Understanding Adobe Alchemy</title>
		<link>http://www.automatastudios.com/2008/11/21/understanding-adobe-alchemy/</link>
		<comments>http://www.automatastudios.com/2008/11/21/understanding-adobe-alchemy/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 17:11:51 +0000</pubDate>
		<dc:creator>Branden</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[adobe]]></category>

		<category><![CDATA[alchemy]]></category>

		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.automatastudios.com/?p=94</guid>
		<description><![CDATA[Adobe recently announced the first public release of a research project code-named Alchemy. Alchemy is a C/C++ to ActionScript compiler that opens up a huge new world for the Flash platform.
Automata Studios has worked closely with engineers over at Adobe for the past few months testing Alchemy and preparing some public samples. We were very [...]]]></description>
			<content:encoded><![CDATA[<p><span>Adobe recently announced the first public release of a research project code-named <a href="http://labs.adobe.com/technologies/alchemy/">Alchemy</a>. Alchemy is a C/C++ to ActionScript compiler that opens up a huge new world for the Flash platform.</span></p>
<p><span>Automata Studios has worked closely with engineers over at Adobe for the past few months testing Alchemy and preparing some public samples. We were very happy to help present the public release at the day 2 keynote of Adobe MAX 2008 earlier this week. You can also see some video of me talking about our work porting <a href="http://www.vorbis.com/">Ogg Vorbis</a> using Alchemy on <a href="http://labs.adobe.com/technologies/alchemy/">Adobe Labs</a>.</span></p>
<p><span>There is currently quite a bit of confusion about Alchemy and this article is a quick attempt to answer the most common questions about the technology. First, let&#8217;s look at what Alchemy really is and what it is doing.</span></p>
<p><span>One of the main pieces of Alchemy is a new backend to the <a href="http://llvm.org/">LLVM compiler infrastructure</a>. LLVM is short for Low Level Virtual Machine. The big idea behind LLVM is that the core LLVM compiler will take code in many different languages and compile it into simple RISC-like instructions that are platform neutral. Then, anyone can write a backend to LLVM that can take LLVMs simple instructions and turn them into actual executables for a given platform. Platforms include x64, ARM, PowerPC, and now ActionScript.</span></p>
<p><span>You may notice how much ActionScript stands out in that list. All of the rest of the members are CPUs - not programming languages. In fact, if you manage to stop Alchemy mid-compile (when it has created the ActionScript, but not yet compiled it into a SWF) and look at the ActionScript that it creates it will look like some odd hybrid of ActionScript 3 and assembly language. In fact you&#8217;ll even see sections that looks suspiciously like inline assembler. This is because the ActionScript compiler that ships with Alchemy does in fact allow for inline AVM2 byte codes.</span></p>
<p><span>Essentially when you compile some C or C++ code with Alchemy the end result is a class that is basically a virtual machine written in ActionScript and AVM2 bytecode. This is also why Alchemy generated SWCs are on the large side - they include everything that C or C++ may need such as the C standard library and POSIX support. For example the stringcho example that ships with Alchemy takes 54 lines of C and spits out 27415 lines of ActionScript. This is also why Alchemy can do things like its built-in <a href="http://en.wikipedia.org/wiki/Green_threads">&#8220;green threads&#8221;</a> that let&#8217;s you run synchronous C asynchronously inside of the Flash Player.</span></p>
<p><span>In addition to the LLVM backend, Alchemy includes a set of scripts that are drop-in replacements for standard development tools like make and autoconf. This allows you to use the standard UNIX-style tool chain to create SWFs and SWCs (and thus easily recompile most existing source with Alchemy). The alc-on and alc-off scripts that ship with Alchemy are in fact swapping the standard tools for the Alchemy tools and vice versa.</span></p>
<p><span>The output you get from Alchemy is generally a SWC (you can get just a SWF if you want, but usually  it won&#8217;t be terribly useful on its own). SWCs created from Alchemy can be used in Flex 3 (as long as the build can target FP10), Flex 4 (&#8221;Gumbo&#8221; - in public preview) and Flash CS4. While I believe there are some switches to make Alchemy compiled code target Flash Player 9, this should be avoided as there were specific changes made to Flash Player 10 that greatly increase runtime speed.</span></p>
<p><span>As you may have guessed by now, once C and C++ code is compiled with Alchemy into a SWF it is subject to all of the rules and limitations of a normal SWF. That means you&#8217;re still in the security sandbox, all visual output goes through the display list, and all network and file access goes through the existing classes. Under the surface, when you instantiate your Alchemy compiled library, the code is allocating a nice chunk of memory into a ByteArray. This is how Alchemy takes pointers, malloc, free, etc and makes those concepts work in ActionScript.</span></p>
<p><span>Knowing that Alchemy is just spitting out the same AVM2 bytecode that Flash and Flex spit out it is pretty confusing how Alchemy code could be faster than standard ActionScript. In fact, it is not faster across the board - just in specific types of operations and when the length of a task can be used to overcome Alchemy&#8217;s intrinsic overhead. Now, that&#8217;s not to say that Alchemy compiled code is slouchy by default. In fact, because LLVM does a lot of optimizations, whereas Flash and Flex have no optimization step built into their compilers, Alchemy code manages to overcome a lot of it is overhead just on its own.</span></p>
<p><span>Now, what are these operations that Alchemy does so well? Memory access and function calls. Alchemy compiled code utilizes new bytecodes added to FP10 for working with ByteArrays - which as you&#8217;ll remember are what make up the &#8220;RAM&#8221; in Alchemy. Function calls are faster because in ActionScript function calls require that their parameters be &#8220;boxed&#8221; and &#8220;unboxed&#8221; into and out of objects for each call. Alchemy code doesn&#8217;t have to do this.</span></p>
<p><span>All of this speediness can be undone though by jumping back and forth between Alchemy code and regular ActionScript. This process is called marshaling and you&#8217;ll want to keep it to a minimum. Marshaling is expensive so you&#8217;ll want to try to create calls that stay in the C code as long as possible. You&#8217;ll also want to try to limit the number of parameters you&#8217;re passing back and forth (it&#8217;s actually best to work directly with Alchemy&#8217;s &#8220;RAM&#8221; if possible).</span></p>
<p><span>As you can see, Alchemy is very powerful, but it is not some magic bullet. More than anything else Alchemy has the potential to drastically speed up the process of bringing existing C/C++ code to the Flash Platform - something that had to be done line-by-line by hand previously. If the ActionScript wrapper around an Alchemy compiled library is well written to take advantage of Alchemy&#8217;s strengths it is even possible to get significant speed improvements (up to an order of magnitude or so) over hand-written ActionScript.</span></p>
<p><span>That&#8217;s it for now, but I plan on writing more about compiling with Alchemy, using GlueGen (a special language you can use with Alchemy to somewhat automate the task of writing C-to-ActionScript glue code), and utlizing Alchemy-compiled libraries within Flash and Flex.</span></p>
<p><span>Finally, let me just give a public &#8220;THANK YOU!&#8221; and &#8220;OMFG U RULEZ!&#8221; to Scott Petersen(the father of alchemy), Joe Steele, and all of the other employees at Adobe that made Alchemy happen - it&#8217;s simply an awesome tool!</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.automatastudios.com/2008/11/21/understanding-adobe-alchemy/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Spiking Greedy SWFs</title>
		<link>http://www.automatastudios.com/2008/10/16/spiking-greedy-swfs/</link>
		<comments>http://www.automatastudios.com/2008/10/16/spiking-greedy-swfs/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 00:52:20 +0000</pubDate>
		<dc:creator>Branden</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[browser]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[spiking]]></category>

		<guid isPermaLink="false">http://www.automatastudios.com/?p=93</guid>
		<description><![CDATA[A project we&#8217;re working on requires third parties to be able to load SWFs of their own design into an overall &#8220;shell&#8221; that we&#8217;re building. So far, so good - particularly with the new unloadAndStop method that&#8217;s part of Flash Player 10. That means I can fully unload the SWFs no matter where they managed [...]]]></description>
			<content:encoded><![CDATA[<p><span>A project we&#8217;re working on requires third parties to be able to load SWFs of their own design into an overall &#8220;shell&#8221; that we&#8217;re building. So far, so good - particularly with the new unloadAndStop method that&#8217;s part of Flash Player 10. That means I can fully unload the SWFs no matter where they managed to sink their teeth/event listeners.</span></p>
<p><span>Then I started to think about a weird edge case&#8230; what if the creators of these SWFs accidentally does something spectacularly bad like get stuck in an infinite loop? I had a few ideas for a solution, and so I decided to <a href="http://c2.com/cgi/wiki?SpikeDescribed">spike</a> them and see if any of them worked (The link explains what spiking is - but in a nutshell it&#8217;s a quick-and-dirty end-to-end solution that tests out an idea).</span></p>
<p><span>To test my solutions I made two SWFs - one with a simple spinning animation (spinner.swf) and another that, with the push of a button, would lock up for 5 seconds (greedy.swf). My first idea was to put the SWFs on the same HTML page and have them talk via LocalConnection. The spinner would monitor the greedy SWF (when ever the greedy one started, it would tell the spinner) and if the greedy SWF went on too long the spinner would talk back out to Javascript and tell it to replace the Flash Player instance. </span></p>
<p><span>That didn&#8217;t work in the slightest.</span></p>
<p><span>As soon as the greedy SWF started getting greedy, the spinner would lock up too. I even tried putting the SWFs in separate HTML files and loading in one via an iframe - same result.</span></p>
<p><span>The next solution was to have Javascript do the monitoring. So now the greedy SWF would call out to Javascript before it started getting greedy and the Javascript would then start a timer. If that timer wasn&#8217;t reset by the greedy SWF finishing it would unload the Flash Player running the greedy SWF. Pretty decent idea, yeah? Nope.</span></p>
<p><span>It seems like (at least in the browsers I tested, Safari and Firefox), when Flash is locked up the rest of the browser, including JS is locked up too. The timer would only first AFTER the greedy SWF stopped on it&#8217;s own accord.</span></p>
<p><span>So where does that bring us? Well, these solutions or something like that may work in IE, particularly since it&#8217;s running on a whole different plugin architecture. It may also work in Chrome since it&#8217;s whole architecture is based on isolating processes. That being said, a real cross-browser solution remains elusive. I guess I&#8217;ll just have to hope the 3rd party SWFs don&#8217;t suck and maybe do a bit of testing on them before I roll them out to the public.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.automatastudios.com/2008/10/16/spiking-greedy-swfs/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SOAP is Just XML</title>
		<link>http://www.automatastudios.com/2008/10/15/soap-is-just-xml/</link>
		<comments>http://www.automatastudios.com/2008/10/15/soap-is-just-xml/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 23:46:32 +0000</pubDate>
		<dc:creator>Keenan</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[API]]></category>

		<category><![CDATA[blog]]></category>

		<category><![CDATA[SOAP]]></category>

		<category><![CDATA[software]]></category>

		<category><![CDATA[web services]]></category>

		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.automatastudios.com/?p=89</guid>
		<description><![CDATA[Recently, Branden and I were tasked to build a Flash UI on top of a web service.  Seems like pretty standard development&#8230;but, as you have to know by now, nothing is ever &#8220;standard&#8221; at Automata.  After some research, trial &#38; error, and hand-wringing, we realized that the device we were attempting to connect to was [...]]]></description>
			<content:encoded><![CDATA[<p><span>Recently, Branden and I were tasked to build a Flash UI on top of a web service.  Seems like pretty standard development&#8230;but, as you have to know by now, nothing is ever &#8220;standard&#8221; at Automata.  After some research, trial &amp; error, and hand-wringing, we realized that the device we were attempting to connect to was using SOAP 1.2.  Well, unfortunately, Flex only supports up to SOAP 1.1, so we had a bit of a problem.</span></p>
<p><span>It didn&#8217;t take us long to remember that SOAP was just XML, and that Flex&#8217;s web service API was just a nice class that makes it easy to speak that language.  After deciding to nix the Flex solution (we were only using Flex for the WebService API), we moved to an all Flash solution.  We created a connector class to act as a web service API, and simply sent XML packets directly to the server using URLLoader.  One note about this solution is that it will only work if you have knowledge of the web service you are trying to use.  In our case, we had the entire schema at our disposal, so we knew the exact format of the service operations.</span></p>
<p><span>The connector class contains public methods to call the individual web service operations.  Additionally, we created individual request classes for each of the operations that extended a class called Abstract Request.  AbstractRequest provides a method send(uri:String, headers:Array) that uses URLLoader to send the request to the server.</span></p>
<p><span>The &#8220;uri&#8221; parameter of send() is the full path to the web service, with the &#8220;http://&#8221; attached.  The headers are the HTTP headers that you need to send to the web service for such things as authentication.  In our code, these are set in the Connector class, and passed to each request as it is needed.  The &#8220;_request&#8221; property holds the XML object that you will pass to the server.  This XML is formatted as an XML packet specific for this web service.  The value for this property is defined in the AbstractRequest sub-classes.</span></p>
<p><span>The _request property is an XML object that defines the format, and uses Flex-style binding to add the actual data from the constructor parameters.  This is a little-known XML trick you can do in AS3.  Branden found it in the Help section of the Flash CS3 IDE.  Pretty neat if you ask me.</span></p>
<p><span>Back to the AbstractRequest class, we simply set the data property of the URLRequest intstance to be the string representaton of the request XML, and call URLLoader.load(), passing in the URLRequest instance.  This sends the XML packet to the server.  The handler for Event.COMPLETE will receive the XML returned from the server.</span></p>
<p><span>Our connector class has methods like:</span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="actionscript actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> addGroup<span style="color: #66cc66;">&#40;</span>groupId:<span style="color: #0066CC;">String</span>, groupName:<span style="color: #0066CC;">String</span>, flag:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> request:AddGroupRequest = <span style="color: #000000; font-weight: bold;">new</span> AddGroupRequest<span style="color: #66cc66;">&#40;</span>groupId, groupName, flag<span style="color: #66cc66;">&#41;</span>;
	request.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ISYResultEvent.<span style="color: #006600;">EVENT</span>, onResult<span style="color: #66cc66;">&#41;</span>;
	request.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ISYFaultEvent.<span style="color: #006600;">EVENT</span>, onFault<span style="color: #66cc66;">&#41;</span>;
	request.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span>_uri, _headers<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p><span>This actually executes the web service call.</span></p>
<p><span>And just like that, you&#8217;ve build your own web service class.  While it&#8217;s quite specific to the web service you are using, you could certainly expand it to consume a WSDL file so you can use it for any web service.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.automatastudios.com/2008/10/15/soap-is-just-xml/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Welcome Aboard, Maureen!</title>
		<link>http://www.automatastudios.com/2008/09/05/welcome-aboard-maureen/</link>
		<comments>http://www.automatastudios.com/2008/09/05/welcome-aboard-maureen/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 15:40:10 +0000</pubDate>
		<dc:creator>Maureen</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.automatastudios.com/?p=87</guid>
		<description><![CDATA[Automata Studios is proud to announce the hiring of Maureen Farrington (that&#8217;s me!), project manager extrordinaire.  Branden likes to add the title &#8220;Producer&#8221; to describe my position since my job will consist of &#8220;making things happen&#8221; as I ease into actual code-producing duties.
This is my first foray back into world of hardcore IT after spending [...]]]></description>
			<content:encoded><![CDATA[<p><span>Automata Studios is proud to announce the hiring of Maureen Farrington (that&#8217;s me!), project manager extrordinaire.  Branden likes to add the title &#8220;Producer&#8221; to describe my position since my job will consist of &#8220;making things happen&#8221; as I ease into actual code-producing duties.</span></p>
<p><span>This is my first foray back into world of hardcore IT after spending three years working in higher education for a local university.  Prior to that I worked for a colocation facility, hence the homecoming for me.  I&#8217;m especially excited to be at a place where interesting ideas are valued over maintaining the status quo.</span></p>
<p><span>Branden and Keenan do simply amazing work here, and I have learned something new each day I&#8217;ve been here for the last two weeks.  I am looking forward to contributing all I can to Automata.</span></p>
<p><span>Oh, and now that I&#8217;m here, this site is going to be updated more frequently.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.automatastudios.com/2008/09/05/welcome-aboard-maureen/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Simplifying code with finite state machines</title>
		<link>http://www.automatastudios.com/2008/07/24/simplifying-code-with-finite-state-machines/</link>
		<comments>http://www.automatastudios.com/2008/07/24/simplifying-code-with-finite-state-machines/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 01:08:59 +0000</pubDate>
		<dc:creator>Branden</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.automatastudios.com/?p=85</guid>
		<description><![CDATA[Yes, it&#8217;s been a while. We&#8217;ve been busy. The good news (for you) is that we&#8217;ve been making fun new things (i.e. code libraries) that we&#8217;ll be sharing soon!
Now, on to the actual topic of this post - finite state machines. What is a finite state machine you ask? Well it&#8217;s just a construct that [...]]]></description>
			<content:encoded><![CDATA[<p><span>Yes, it&#8217;s been a while. We&#8217;ve been busy. The good news (for you) is that we&#8217;ve been making fun new things (i.e. code libraries) that we&#8217;ll be sharing soon!</span></p>
<p><span>Now, on to the actual topic of this post - finite state machines. What is a finite state machine you ask? Well it&#8217;s just a construct that lets you track the states within a piece of code and ensure that you only do what you&#8217;re allowed to do when you&#8217;re allowed to do it.</span></p>
<p><span>A while back I wrote a generic finite state machine (I called it PastaMachine - since every time I wrote FSM I thought of the <a href="http://www.venganza.org/">Flying Spaghetti Monster</a>). It is exceptionally generic - you just define states, define the allowed transitions between those states (state A can go to state B, but B can&#8217;t go back to A, etc) and the actions that each state may take (an action may trigger a transition, but it doesn&#8217;t have to). The states themselves can have attached to them an arbitrary amount of metadata and in less than 340 lines of code you have a simple finite state machine.</span></p>
<p><span>What can you do with it? Well, originally it was written to handle a branching logic game where depending on the users success at a simple game they went down multiple paths and were shown various different videos (yeah&#8230; it was a PG-13 strip poker game). But recently Keenan has been using PastaMachine to track the logic of an application to assist doctors in treating patients with HPV. If that&#8217;s not a nice range of usefulness, I don&#8217;t know what is!</span></p>
<p><span>One nice extra trick PastaMachine has up it&#8217;s sleeve is that once you&#8217;ve defined a state machine with it you can export the information about that state machine to data in DOT format. That DOT data can be loaded into the ever-so-awesome <a href="http://www.graphviz.org/">GraphViz</a> and BAM! you have a directed graph diagram of your state machine! It&#8217;s actually really useful in debugging the state machine&#8217;s connections, but beyond that it adds a very nice &#8220;WOW!&#8221; factor when you present it to your client.</span></p>
<p><span>Over the next few weeks we&#8217;ll be cleaning up PastaMachine and sharing it with everyone. Then, if everything goes smoothly, there will be a number of other Automata code libraries following along behind it.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.automatastudios.com/2008/07/24/simplifying-code-with-finite-state-machines/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Charles - A great web application debugging tool!</title>
		<link>http://www.automatastudios.com/2008/04/09/charles-a-great-web-application-debugging-tool/</link>
		<comments>http://www.automatastudios.com/2008/04/09/charles-a-great-web-application-debugging-tool/#comments</comments>
		<pubDate>Wed, 09 Apr 2008 19:33:42 +0000</pubDate>
		<dc:creator>Branden</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[software]]></category>

		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.automatastudios.com/2008/04/09/charles-a-great-web-application-debugging-tool/</guid>
		<description><![CDATA[During a recent project of ours we found ourselves in the position where the developer creating the server-side code was a full 5 time zones away. This meant that we often had to do debugging over email. This was, as one would expect, excruciatingly slow. The issues that arose during integration almost always resolved around [...]]]></description>
			<content:encoded><![CDATA[<p><span>During a recent project of ours we found ourselves in the position where the developer creating the server-side code was a full 5 time zones away. This meant that we often had to do debugging over email. This was, as one would expect, excruciatingly slow. The issues that arose during integration almost always resolved around how we were mapping the servers .Net classes to our AS3 classes - one small change to the server class could break things on our end in a non-obvious way.</span></p>
<p><span>Luckily early in this process we discovered a piece of shareware called <a href="http://www.xk72.com/charles/">Charles</a>, a web debugging proxy that&#8217;s available for Mac, PC, and Linux. Once you fire Charles up it acts as a proxy for all of your web traffic. This lets you capture, view, and even throttle the data that&#8217;s flowing between your machine and the web server. And best of all for us, it lets you view inside of AMF packets and see exactly what&#8217;s coming over the wire. Once we got Charles up and working we able to tackle kind of issues that used to take us hours and resolve them in minutes.</span></p>
<p><span>We haven&#8217;t done a done with Charles yet, but so far our only wish is that we knew about it sooner. Suffice it to say that we found the $50 registration fee to be well worth it!</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.automatastudios.com/2008/04/09/charles-a-great-web-application-debugging-tool/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Does Your Tween Stop In The Middle?</title>
		<link>http://www.automatastudios.com/2007/12/11/does-your-tween-stop-in-the-middle/</link>
		<comments>http://www.automatastudios.com/2007/12/11/does-your-tween-stop-in-the-middle/#comments</comments>
		<pubDate>Tue, 11 Dec 2007 15:56:10 +0000</pubDate>
		<dc:creator>Keenan</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[animation]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.automatastudios.com/?p=86</guid>
		<description><![CDATA[Branden and I were working in the office today when Branden came over and asked me if I&#8217;ve ever run into the following problem:
You are creating tweens using the Tween class in AS3.   These tweens are inside of a method (or a loop).  The tweens appear to work fine, except, they stop [...]]]></description>
			<content:encoded><![CDATA[<p><span>Branden and I were working in the office today when Branden came over and asked me if I&#8217;ve ever run into the following problem:</span></p>
<p><span>You are creating tweens using the Tween class in AS3.   These tweens are inside of a method (or a loop).  The tweens appear to work fine, except, they stop in the middle without explanation.  As it turns out, I had run into this problem before.  While working on a previous project, I had a series of tweens moving around a Rectangle object inside a class method.  Halfway through the tween, it stopped for no apparent reason.  After using everyone&#8217;s favorite inter-web fast-food chain, Google, I determined that the issue must be due to garbage collection.  I typed in &#8220;AS3 tween garbage collection&#8221;, and found that my problem had been solved and discussed by Scott Morgan.  <a href="http://www.scottgmorgan.com/blog/index.php/2007/11/18/as3-garbage-collection-the-reason-your-tweens-are-ending-early/">Here&#8217;s his blog post about it</a>.</span></p>
<p><span>The solution, as described by Scott is to create class properties for your tweens instead of local variables.  As I described this to Branden, he noted a potential problem with this solution.  When you use class properties, the Flash player will allocate space for those properties, even when you are not using them.  Why is this a problem?  Well, imagine you can potentially have hundreds of instances of a class, where each instance contains private properties for 5 tweens.  This could significantly hurt the performance of your application since you will have allocated space for all of those tweens, even though the tweens are not running.  Needless to say, while this is a good solution, and great in a pinch, ultimately, you will have problems for large numbers of tweens.</span></p>
<p><span>So, how do you solve the secondary problem of allocating space for tweens that are not running?  Is there a way to use a class property to store the tween (so it is not killed by the garbage collector), without actually allocating space until the tween is needed?</span></p>
<p><span>The answer: DICTIONARY!</span></p>
<p><span>Instead of creating a property for each tween you use, instead, create a single property of type <a title="http://livedocs.adobe.com/flex/201/langref/flash/utils/Dictionary.html" href="http://">flash.utils.Dictionary</a>. The Dictionary class allows you to create a set of dynamic properties, without allocating the space for them until the property is actually created.  Additionally, you can also use an object reference as a key in a dictionary, which can be a very powerful tool.  Once you have your dictionary, inside the method (or loop) that creates the tweens, store the tween object reference as the key in the dictionary.  Once your tween is complete, delete the key and your tween will be collected by the garbage collector.</span></p>
<p><span>Here&#8217;s an example:</span></p>
<p><span>
<ul></span></p>
<p><span>
<li> <a href="http://www.automatastudios.com/downloads/tween%20garbage%20collection.zip">Source Code</a></li>
<p></span></p>
<p><span></ul>
<p></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.automatastudios.com/2007/12/11/does-your-tween-stop-in-the-middle/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to pronounce our name&#8230;</title>
		<link>http://www.automatastudios.com/2007/12/10/how-to-pronounce-our-name/</link>
		<comments>http://www.automatastudios.com/2007/12/10/how-to-pronounce-our-name/#comments</comments>
		<pubDate>Mon, 10 Dec 2007 16:57:42 +0000</pubDate>
		<dc:creator>Branden</dc:creator>
		
		<category><![CDATA[Frequently Asked Questions]]></category>

		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.automatastudios.com/2007/12/10/how-to-pronounce-our-name/</guid>
		<description><![CDATA[Just as a public service message - it&#8217;s not &#8220;auto-mata&#8221; - it rhymes with &#8220;manamana&#8221; as demonstrated by the Muppet Show:

(Thanks to Tom Pizer over at Performtech who dug up the video)
]]></description>
			<content:encoded><![CDATA[<p><span>Just as a public service message - it&#8217;s not &#8220;auto-mata&#8221; - it rhymes with &#8220;manamana&#8221; as demonstrated by the Muppet Show:</span></p>
<p><span><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/OfK9gvnngY4&#038;rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/OfK9gvnngY4&#038;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></span></p>
<p><span>(Thanks to Tom Pizer over at Performtech who dug up the video)</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.automatastudios.com/2007/12/10/how-to-pronounce-our-name/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Making Leopard&#8217;s Quicklook Feature (more) Useful</title>
		<link>http://www.automatastudios.com/2007/11/27/making-leopards-quicklook-feature-more-useful/</link>
		<comments>http://www.automatastudios.com/2007/11/27/making-leopards-quicklook-feature-more-useful/#comments</comments>
		<pubDate>Wed, 28 Nov 2007 03:47:14 +0000</pubDate>
		<dc:creator>Branden</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[Mac]]></category>

		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.automatastudios.com/2007/11/27/making-leopards-quicklook-feature-more-useful/</guid>
		<description><![CDATA[I&#8217;ve been dealing with piles of two types of files that are somewhat awkward to work with on the Mac - ZIP files and EPS files. On the PC I can just double click on a ZIP file and peer into what&#8217;s inside without actually unzipping it, on the Mac, not so much. When it [...]]]></description>
			<content:encoded><![CDATA[<p><span>I&#8217;ve been dealing with piles of two types of files that are somewhat awkward to work with on the Mac - ZIP files and EPS files. On the PC I can just double click on a ZIP file and peer into what&#8217;s inside without actually unzipping it, on the Mac, not so much. When it comes to EPS files, I&#8217;ll open then with preview and then get a lovely spinning beachball while it is &#8220;Converting Postscript to PDF&#8230;&#8221;. Now admittedly it&#8217;s faster on Leopard that it was on Tiger, but still, that sucks. Luckily these are exactly the kinds of problems Quicklook was made to handle.</span></p>
<p><span>If you haven&#8217;t played with Quicklook, you just select a file and hit the spacebar - you then get a preview of the contents of the file. By default it works with iWork formats, and all the usual MS Office formats. The best part though is that third parties can write their own plugins for Quicklook - and developers have already made some for ZIP and EPS! Now I just select either file type and smack the spacebar and BAM! almost immediately I can peer inside of ZIP files or preview EPS files.</span></p>
<p><span>It&#8217;s times like these I *really* love the Mac developer community (and Apple ain&#8217;t half bad either, though I&#8217;m still not fully digging Stacks!).</span></p>
<p><span>
<ul></span></p>
<p><span>
<li><a href="http://d.hatena.ne.jp/t_trace/20071125/p2">ZIP Quicklook Plugin</a></li>
<p></span></p>
<p><span>
<li><a href="http://www.eternalstorms.at/utilities/epsqlplg/index.html">EPS Quicklook Plugin</a></li>
<p></span></p>
<p><span>
<ul></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.automatastudios.com/2007/11/27/making-leopards-quicklook-feature-more-useful/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Nooks and Crannies of ActionScript 3</title>
		<link>http://www.automatastudios.com/2007/11/17/the-nooks-and-crannies-of-actionscript-3/</link>
		<comments>http://www.automatastudios.com/2007/11/17/the-nooks-and-crannies-of-actionscript-3/#comments</comments>
		<pubDate>Sat, 17 Nov 2007 22:21:40 +0000</pubDate>
		<dc:creator>Branden</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[News]]></category>

		<category><![CDATA[Source Code]]></category>

		<guid isPermaLink="false">http://www.automatastudios.com/2007/11/17/the-nooks-and-crannies-of-actionscript-3/</guid>
		<description><![CDATA[The slides from Branden&#8217;s presentation at FITC Hollywood 2007, Flash on the Beach 2007, and FITC Winnipeg 2007 - &#8220;The Nooks and Crannies of ActionScript 3&#8243; are now available for download. Enjoy - and if you have any questions or comments drop us a line.



The Nooks and Crannies of ActionScript 3



]]></description>
			<content:encoded><![CDATA[<p><span><img src="http://www.automatastudios.com/images/nooks_2007.jpg" align="right">The slides from Branden&#8217;s presentation at FITC Hollywood 2007, Flash on the Beach 2007, and FITC Winnipeg 2007 - &#8220;The Nooks and Crannies of ActionScript 3&#8243; are now available for download. Enjoy - and if you have any questions or comments <a href="http://www.automatastudios.com/company-info/contact-info/">drop us a line.</a></span></p>
<p><span>
<ul></span></p>
<p><span>
<li><a href="http://www.automatastudios.com/downloads/nooks_2007.pdf">The Nooks and Crannies of ActionScript 3</a></li>
<p></span></p>
<p><span></ul>
<p></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.automatastudios.com/2007/11/17/the-nooks-and-crannies-of-actionscript-3/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
