0 Replies Latest reply on Jan 8, 2009 6:17 AM by MyOneOfaKindSelf

    Flex/Air Update Object Issue...

      The following code is from the Air Employee Directory example to which I have added an Update Object, the app installs and updates with no problem, but as soon as the update is done and it's time for the app to start, the app just doesn't come up. It was working fine before I added the update object... Any idea on what I could be doing wrong?

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"

      layout="absolute" xmlns:ui="com.adobe.empdir.ui.*"
      applicationComplete="onApplicationComplete()" height="100%" width="100%" frameRate="45"
      horizontalScrollPolicy="off" verticalScrollPolicy="off" visible="false"

      showEffect="Fade" xmlns:local="*" creationComplete="checkUpdate()">

      import mx.logging.Log;
      import com.adobe.empdir.commands.ui.CloseApplicationCommand;

      import mx.binding.utils.BindingUtils;
      import mx.events.StateChangeEvent;
      import mx.events.ResizeEvent;

      private function onApplicationComplete() : void
      callLater( ui.init );

      // We listen to CLOSING fromboth the stage and the UI. If the user closes the app through the taskbar,
      // Event.CLOSING is emitted from the stage. Otherwise, it could be emitted from TitleConrols.mxml.

      ui.addEventListener( Event.CLOSING, onWindowClosing );
      stage.nativeWindow.addEventListener( Event.CLOSING, onWindowClosing );
      stage.nativeWindow.addEventListener( Event.CLOSE, onWindowClose );


      private function onWindowClose( evt:Event ) : void

      private function onWindowClosing( evt:Event ) : void

      var cmd : CloseApplicationCommand = new CloseApplicationCommand();


      import air.update.events.UpdateEvent;

      import mx.controls.Alert;
      import flash.events.ErrorEvent;
      import air.update.ApplicationUpdaterUI;

      * @var the object that that handles the update related actions
      private var appUpdater:ApplicationUpdaterUI = new ApplicationUpdaterUI();

      * This function is triggered when the application finished to load;
      * Here we initialize <code>appUpdater</code> and set some properties
      private function checkUpdate():void {

      // we set the URL for the update.xml file
      appUpdater.updateURL = " http://localhost/updater/update.xml";
      //we set the event handlers for INITIALIZED nad ERROR

      appUpdater.addEventListener(UpdateEvent.INITIALIZED, onUpdate);
      appUpdater.addEventListener(ErrorEvent.ERROR, onError);
      //we can hide the dialog asking for permission for checking for a new update;
      //if you want to see it just leave the default value (or set true).

      appUpdater.isCheckForUpdateVisible = false;
      //if isFileUpdateVisible is set to true, File Update, File No Update,
      //and File Error dialog boxes will be displayed
      appUpdater.isFileUpdateVisible = false;

      //if isInstallUpdateVisible is set to true, the dialog box for installing the update is visible
      appUpdater.isInstallUpdateVisible = false;
      //we initialize the updater

      * Handler function triggered by the ApplicationUpdater.initialize;
      * The updater was initialized and it is ready to take commands
      * (such as <code>checkNow()</code>
      * @param UpdateEvent

      private function onUpdate(event:UpdateEvent):void {
      //start the process of checking for a new update and to install

      * Handler function for error events triggered by the ApplicationUpdater.initialize

      * @param ErrorEvent
      private function onError(event:ErrorEvent):void {

      * A simple code just to read the current version of the application
      * and display it in a label.

      private function setApplicationVersion():void {
      var appXML:XML = NativeApplication.nativeApplication.applicationDescriptor;
      var ns:Namespace = appXML.namespace();

      <mx:TraceTarget level="0" includeDate="false" includeTime="false"
      includeCategory="true" includeLevel="true">


      <ui:ApplicationUI id="ui" width="100%" height="100%" />