window.addEventListener('load', function(){ init(); }, false );

var appUpdater = new runtime.air.update.ApplicationUpdaterUI(); ;

var init = function(){
  appUpdater.configurationFile = new air.File("app:/config/updateConfig.xml");

  /* Memo 
  "UNINITIALIZED" The updater has not been initialized.
  "INITIALIZING" The updater is initializing.
  "READY" The updater has been initialized
  "BEFORE_CHECKING" The updater has not yet checked for the update descriptor file.
  "CHECKING" The updater is checking for an update descriptor file.
  "AVAILABLE" The updater descriptor file is available.
  "DOWNLOADING" The updater is downloading the AIR file.
  "DOWNLOADED" The updater has downloaded the AIR file.
  "INSTALLING" The updater is installing the AIR file.
  "PENDING_INSTALLING" The updater has initialized and there are pending updates.
   */

  appUpdater.addEventListener(runtime.air.update.events.UpdateEvent.INITIALIZED, onUpdate );

  appUpdater.initialize();

  document.getElementById('res').innerHTML = 'Miku Hatune loading....';
  setTimeout( function(){ document.getElementById('res').innerHTML = 'load End'; }, 3000 );
}

var onUpdate = function(){
  appUpdater.checkNow();
}
