<?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>Software and Opinions &#187; actionscript</title>
	<atom:link href="http://ianloic.com/tag/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://ianloic.com</link>
	<description>from Ian McKellar</description>
	<lastBuildDate>Thu, 19 Nov 2009 22:05:43 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Restarting an AIR application</title>
		<link>http://ianloic.com/2009/03/11/restarting-an-air-application/</link>
		<comments>http://ianloic.com/2009/03/11/restarting-an-air-application/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 00:40:45 +0000</pubDate>
		<dc:creator>Ian McKellar</dc:creator>
				<category><![CDATA[Default]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobeair]]></category>

		<guid isPermaLink="false">http://ianloic.com/?p=111</guid>
		<description><![CDATA[For reasons too complicated and secret to go into here I&#8217;m writing an Adobe AIR application that needs to restart itself occasionally. I didn&#8217;t find any clear documents describing how to do this but after some reverse engineering and experimentation, here&#8217;s what I came up with.
The air.swf movie that&#8217;s used by web pages to install [...]]]></description>
			<content:encoded><![CDATA[<p>For reasons too complicated and secret to go into here I&#8217;m writing an Adobe AIR application that needs to restart itself occasionally. I didn&#8217;t find any clear documents describing how to do this but after some reverse engineering and experimentation, here&#8217;s what I came up with.</p>
<p>The <em>air.swf</em> movie that&#8217;s used by web pages to install and launch AIR applications calls some internal, undocumented APIs to do this, and so can you!</p>
<pre class="prettyprint">
namespace {
  import adobe.utils.ProductManager;
  import mx.core.Application;
  public class Restart {
    public static function restart() : void {
      // request that a new instance of the application be launched
      new ProductManager('airappinstaller').launch('-launch ' +
        Application.application.nativeApplication.applicationID + ' ' +
        Application.application.nativeApplication.publisherID);
      // exit the current instance
      Application.application.nativeApplication.exit(0);
    }
  }
}</pre>
<p>I don&#8217;t know if or when this will break but it&#8217;s pretty straight-forward, once you work it out. It feels to me like there might be some kind of race condition, but it seems to work alright. Oh also, I&#8217;ve only tried this on Mac.</p>
]]></content:encoded>
			<wfw:commentRss>http://ianloic.com/2009/03/11/restarting-an-air-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Three Months of ActionScript</title>
		<link>http://ianloic.com/2009/02/27/three-months-of-actionscript/</link>
		<comments>http://ianloic.com/2009/02/27/three-months-of-actionscript/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 19:45:47 +0000</pubDate>
		<dc:creator>Ian McKellar</dc:creator>
				<category><![CDATA[Default]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[ecmascript]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex builder]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://ianloic.com/?p=106</guid>
		<description><![CDATA[I&#8217;ve been working largely in ActionScript 3 for the past three months. After spending four years working primarily in JavaScript I didn&#8217;t expect to encounter too many problems with her cousin. That expectation was pretty well borne out.
I was particularly excited at the chance to play with ActionScript&#8217;s optional strict typing since that has been [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working largely in <a href="http://en.wikipedia.org/wiki/ActionScript">ActionScript 3</a> for the past three months. After spending four years working primarily in <a href="http://en.wikipedia.org/wiki/JavaScript">JavaScript</a> I didn&#8217;t expect to encounter too many problems with her cousin. That expectation was pretty well borne out.</p>
<p>I was particularly excited at the chance to play with ActionScript&#8217;s optional strict typing since that has been under consideration for future versions of JavaScript / <a href="http://en.wikipedia.org/wiki/ECMAScript">ECMAScript</a>. AS3&#8217;s strict typing hasn&#8217;t felt optional to me because I&#8217;ve been largely using the <a href="http://en.wikipedia.org/wiki/Adobe_Flex_Builder">Flex Builder IDE</a> and it excitedly warns me every time I fail to specify a type on a variable or function signature, so I put them everywhere. Instead of implementing encapsulation using conventions like I do in JS I use AS3&#8217;s Interfaces. This felt good at first but I quickly realized that I couldn&#8217;t do the kinds of tricks that I&#8217;d become accustomed to in JS. I can&#8217;t create a typed object in a function and return it without defining a class for it in its own file. This has made the higher level structure of my software far closer to Java than to JavaScript.</p>
<p>On the other hand, inside my functions I&#8217;m pretty much writing JavaScript. All of the standard JS built-in objects (Object, Array, Math, etc) behave like modern JS implementations. I use anonymous functions to manipulate and filter arrays. I use Objects and Arrays as my primary data structures.</p>
<p>At this point I&#8217;m pretty used to AS3. I know how to design my code and I can be pretty productive, not needing to rewrite everything too many times. I&#8217;d like to see Adobe mix the Java-style classes and interfaces up with the JavaScript habit of declaring anonymous functions and objects as you go. I&#8217;d be thrilled if I could write something like:<br />
<code><br />
var x : IMyInterface = new IMyInterface {<br />
method: function() : void { ... },<br />
field: 42<br />
};<br />
</code></p>
<p>I see that they&#8217;re extending the language to support <a href="http://thebackbutton.com/blog/65/new-vector-actionscript-3s-typed-array/">limited generics support</a> so hopefully that won&#8217;t be the end of it. I&#8217;m looking forward to experimenting more on the platform.</p>
]]></content:encoded>
			<wfw:commentRss>http://ianloic.com/2009/02/27/three-months-of-actionscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
