AIR Remote Updater
Hi all,
I found a very useful AIR remote updater http://codeazur.com.br/lab/airremoteupdater/ written by Claus Wahlers. It works fine but I have a question which I myself can't figure it out.
Just a newbie in flash I guess.
Question:
What if the script can't find yourapplication.air inside my domain.com host?
What will happen?
I have tested it out. It appears that the script keep on running to find yourapplication.air inside my server. But it is not there. How do I make a timeout when if there is no such "yourapplication.air" file in the server / it will skip the update process?
public function update():void { var request:URLRequest = new URLRequest("http://domain.com/yourapplication.air"); var updater:AIRRemoteUpdater = new AIRRemoteUpdater(); updater.addEventListener(AIRRemoteUpdaterEvent.VERSION_CHECK, updaterVersionCheckHandler); updater.addEventListener(AIRRemoteUpdaterEvent.UPDATE, updaterUpdateHandler); updater.update(request); } protected function updaterVersionCheckHandler(event:AIRRemoteUpdaterEvent):void { // The AIRRemoteUpdaterEvent.VERSION_CHECK event is fired // as soon as both local and remote version numbers are known. var updater:AIRRemoteUpdater = event.target as AIRRemoteUpdater; trace("Local version: " + updater.localVersion); trace("Remote version: " + updater.remoteVersion); // You can stop execution of AIR Remote Updater at this point // by calling event.preventDefault(), for example to inform the user // that a new version is available and/or ask if she likes to download // and install it. When the user confirms, call AIRRemoteUpdater.update() // again with the versionCheck argument set to "false". This will // circumvent the version checking procedure and immediately // starts to download the remote .AIR installer file to a temporary // file on the user's harddisk. } protected function updaterUpdateHandler(event:AIRRemoteUpdaterEvent):void { // The AIRRemoteUpdaterEvent.UPDATE event is fired when // the remote .AIR installer file has finished downloading. // The event's "file" property contains a reference to the // temporary file on the user's harddisk. trace("Installer: " + event.file.nativePath); // You can stop execution of AIR Remote Updater at this point // by calling event.preventDefault(), for example to inform the user // that the application is about to shut down and update itself. }