0 Replies Latest reply on Sep 3, 2010 11:01 AM by shades0404

    Re-Initializing ApplicationUpdater




      I'm having some issues with the ApplicationUpdater class in AIR 2.0. I need to be able to change the updateURL on-the-fly in my application, so I figured the best way would be to create a new ApplicationUpdater each time the URL changes. This seems to work, except it seems like old ApplicationUpdaters still dispatch status events, even though there should only be a single instance of ApplicationUpdater. Here's pseudo-code describing the situation:


      private var appUpdater:ApplicationUpdater;


      public function initUpdater(url:String) {

           appUpdater = new ApplicationUpdater();

           appUpdater.addEventListener(StatusUpdateEvent.UPDATE_STATUS, updateStatusHandler);

           appUpdater.addEventListener(UpdateEvent.INITIALIZED, updaterInitialized);

           appUpdater.updateURL = url;




      updateStatusHandler gets called the number of times initUpdater(url:String) is called. So, if it's called 3 times, 3 events get dispatched to updateStatusHandler. I tried just changing the appUpdater URL and not re-initializing, but this only dispatched status events the first time checkNow() was called (is it because ApplicationUpdater is in the wrong state?). It seems like I can only get checkNow() to work the very first time after it's initialized.


      I event tried to remove the event listeners before creating the new ApplicationUpdater, which had no effect.


      Any idea what the issue could be?