Packagejp.seagirl.desktop
Classpublic class ApplicationUpdate
InheritanceApplicationUpdate Inheritance flash.events.EventDispatcher

AIRアプリケーションのアップデート処理をするためのクラス


Example
アップデート処理の例
package {
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.events.ProgressEvent;
    
    import jp.s2factory.yoshizu.desktop.ApplicationUpdate;

    public class ApplicationUpdateExample extends Sprite
    {
        public static const VERSION_FILE:String = 'http://www.s2factory.co.jp/version.xml';
        public static const AIR_FILE:String = 'http://www.s2factory.co.jp/dist/update.air';
        public static const SAVE_AS:String = 'updates/update.air';
        
        public function ApplicationUpdateExample()
        {
            addEventListener(Event.ADDED_TO_STAGE, addToStageHandler);
            
            updateManager = new ApplicationUpdate();
            updateManager.addEventListener(ProgressEvent.PROGRESS, updateManagerProgressHandler);
            updateManager.addEventListener(Event.COMPLETE, updaterCompleteHandler);
            updateManager.update(VERSION_FILE, AIR_FILE, SAVE_AS);
        }
        
        private var updateManager:ApplicationUpdate;
        
        private function addToStageHandler(event:Event):void
        {
            stage.frameRate = 30;
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;
        }
        
        private function updateManagerProgressHandler(event:ProgressEvent):void
        {
            trace('progress: ', event.bytesLoaded, '/', event.bytesTotal);
        }
        
        private function updaterCompleteHandler(event:Event):void
        {
            trace('complete: ')
        }
    }
}
  



Public Methods
 MethodDefined by
  
ApplicationUpdate(debug:int = 0)
コンストラクタ
ApplicationUpdate
  
update(versionFile:String, airFile:String, saveAs:String):void
アップデート情報をチェックし、必要があればアップデート処理を実行します。
ApplicationUpdate
Events
 EventSummaryDefined by
   アップデート処理が完了すると発行されます。 ApplicationUpdate
   アップデート時に、新しいAIRファイルをダウンロードしている間に発行されます。 ApplicationUpdate
Constructor detail
ApplicationUpdate()constructor
public function ApplicationUpdate(debug:int = 0)

コンストラクタ

Parameters
debug:int (default = 0) — デバッグモードにする場合は引数に1を与えます。 デバッグモードでは、このインスタンスが新しいAIRファイルをダウンロードしてきたところで、 flash.desktop.Updateクラスのupdateメソッドを実際には呼ばずに完了イベントを送出します。 これはアプリケーションをadlで動かしている時に、このメソッドを呼ぶことが出来ない (ランタイムエラーが発生する)のを防ぐ目的で用います。
Method detail
update()method
public function update(versionFile:String, airFile:String, saveAs:String):void

アップデート情報をチェックし、必要があればアップデート処理を実行します。

Parameters
versionFile:String — バージョン情報が記載されているファイルへのURL
 
airFile:String — 新しいAIRファイルへのURL
 
saveAs:String — ダウンロードした新しいAIRファイルの保存先であるローカルストレージ内におけるパス
Event detail
completeevent 
Event object type: flash.events.Event

アップデート処理が完了すると発行されます。

progressevent  
Event object type: flash.events.ProgressEvent

アップデート時に、新しいAIRファイルをダウンロードしている間に発行されます。