태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.

ria/air2008/03/07 10:53

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

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.
}

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


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

'ria > air' 카테고리의 다른 글

[AIR] 자동 업데이트...  (0) 2008/11/24
AIR Remote Updater  (0) 2008/03/07
Adobe AIR 베타3의 컴파일 주의사항  (0) 2008/03/04
어도비, RIA 플랫폼 'AIR' 공식 발표  (0) 2008/02/26
Posted by THLIFE.net
TAG ,

TRACKBACK http://thlife.net/trackback/624 관련글 쓰기

댓글을 달아 주세요