<?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; adobeair</title>
	<atom:link href="http://ianloic.com/tag/adobeair/feed/" rel="self" type="application/rss+xml" />
	<link>http://ianloic.com</link>
	<description>from Ian McKellar</description>
	<lastBuildDate>Wed, 07 Sep 2011 21:48:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://ianloic.com/?pushpress=hub'/>
		<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, &#8230; <a href="http://ianloic.com/2009/03/11/restarting-an-air-application/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></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>3</slash:comments>
		</item>
	</channel>
</rss>

