blog
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);
});
}