'Update'에 해당되는 글 1건

  1. 2008.04.06 AIR 자동 업데이트 설정하기
프로그래밍/Flex/AIR2008.04.06 17:47

http://codeazur.com.br/lab/airremoteupdater/


일단 발견만 했습니다. 지금 해보려고 하는 중이고. ^^;

아마 잘 될 것 같습니다.

해보고 다시 댓글 추가하겠습니다 ^^;;

[추가] 결론은 잘 됩니다. 버전 설정 부분만 숫자랑 . 등으로 구성하시면 됩니다.


côdeazur brasil lab

AIR Remote Updater

The AIR Remote Updater is an Actionscript 3 class to automate remote software updates in Adobe AIR applications.

It transparently checks version numbers, downloads the .AIR installer file if needed and triggers the AIR-native update process. It grabs the version number directly from the remote .AIR file without having to download the entire file, eliminating the potential error prone need of having to put a separate descriptor file online along with the .AIR installer file.

Background

An .AIR installer file is a PKZIP archive containing metadata files along with the packaged application files. The files contained in a .AIR installer file are, in this order:

  • /mimetype
  • /META-INF/AIR/application.xml (contains version info)
  • /META-INF/AIR/hash
  • /META-INF/signatures.xml
  • packaged application files

The file we are interested in, /META-INF/AIR/application.xml (the "application descriptor file"), is always the second file in the archive. FZip is used to stream in the remote .AIR until (and only until) the application descriptor file has loaded. We can then close the stream, uncompress that file and extract the version number.

Usage

<PRE class=actionscript>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.}</PRE>

Download

AIR Remote Updater 1.0.003

History

AIR Remote Updater 1.0.003

  • Release for AIR 1.0.

AIR Remote Updater 1.0.002

  • Release for AIR Beta 2.

AIR Remote Updater 1.0.001

  • Initial Release.

License

AIR Remote Updater is released under the OSI approved zlib/libpng license.

Author

Claus Wahlers


p.s.

주의하실 점은..
<!-- An application version designator (such as "v1", "2.5", or "Alpha 1"). Required. -->
<version>20080306.007</version>
등으로 숫자로 넣어야 버전 비교가 잘 됩니다.

var rv:Number = parseFloat(_remoteVersion);
var lv:Number = parseFloat(_localVersion);
으로 비교하기 때문에.

결론은 잘 됩니다.
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
initialize="init(); update();" 등으로 저 함수를 호출해주시면 실행하자마자
버전 비교하고 강제(선택없이 업데이트 됩니다. )
event.preventDefault() 등으로 업데이트를 막을 수도 있습니다.



Posted by 시난
TAG ,