Quick Tip: ApplicationUpdater for Updating AIR Executables

Few days ago I red an interesting article about Auto update for Adobe Air executable. This article is pretty self-explanatory, it is important to notice, you have to use ApplicationUpdater instead of ApplicationUpdaterUI that was designed for .air apps. One thing I was missing there was to make the process even more dynamic by reading the update url from an update.xml file. Long story short here is a piece of code doing exact the thing:

// var updater:ApplicationUpdater;
var xml:XML = updater.updateDescriptor;
var ns:Namespace = xml.namespace();
var request:URLRequest = new URLRequest(xml.ns::url);
navigateToURL(request);

After wiring it up here is the replacement for onUpdateStatus method from the original article.

private function onUpdateStatus(event:StatusUpdateEvent):void
{
	if(!event.available)
		return;
	
	Alert.show("An updated version " + event.version + " is available. Do you want to download?",
		"Update Available", Alert.YES|Alert.NO, null, 
		function(event:CloseEvent):void
		{
			if(event.detail != Alert.YES)
				return;
			
			var xml:XML = updater.updateDescriptor;
			var ns:Namespace = xml.namespace();
			var request:URLRequest = new URLRequest(xml.ns::url);
			navigateToURL(request);
		});
}

2 comments so far

  1. Jens Eckervogt October 27, 2012 04:54

    Good tutorial 🙂

    How do i create custom update window with affter downloading process than i would like to suggest. Thanks for suggestion. i will try your great code 🙂

    Regards, Jens!

  2. Jozef Chúťka October 29, 2012 10:53

    hi Jens,
    unfortunately my post does not cover custom skinning. but have a look over internet you may find some interesting articles like this one http://www.websector.de/blog/2009/09/09/custom-applicationupdaterui-for-using-air-updater-framework-in-flex-4/

Leave a comment

Please be polite and on topic. Your e-mail will never be published.