6

How can I get a standalone Adobe Air/Flex application to restart itself?

It doesn't work with the suggested solution on: http://www.colettas.org/?p=267.

Any help would be great,

Thanks.

Josh
  • 10,961
  • 11
  • 65
  • 108
Gabriël
  • 1,323
  • 2
  • 22
  • 34

2 Answers2

7

Hello dear i have been fixed this methode for Flex 4.6

package
{
    import adobe.utils.ProductManager;

    import flash.desktop.NativeApplication;

    import mx.core.FlexGlobals;
    import spark.components.WindowedApplication;

    public function Reboot():void
    {
        var app:WindowedApplication = WindowedApplication(FlexGlobals.topLevelApplication);

        var mgr:ProductManager = new ProductManager("airappinstaller");
        mgr.launch("-launch "+app.nativeApplication.applicationID+" "+app.nativeApplication.publisherID);
        app.close();
    }
}
VMAtm
  • 27,943
  • 17
  • 79
  • 125
SourceSkyBoxer
  • 141
  • 1
  • 8
  • PS: Thanks for edit, VMAtm :) @rightPath you must read different version by mx and spark component frameworks :) Thanks for improvement :) – SourceSkyBoxer Feb 16 '14 at 12:17
3
package
{
  import mx.core.Application;
  import mx.core.WindowedApplication;
  import adobe.utils.ProductManager;

  public function reboot():void
  {
    var app:WindowedApplication =
        WindowedApplication(Application.application);

    var mgr:ProductManager =
        new ProductManager("airappinstaller");

    mgr.launch("-launch " +
        app.nativeApplication.applicationID + " " +
        app.nativeApplication.publisherID);

    app.close();
  }
}

Also make sure that the “allowBrowserInvocation” option is turned on in the AIR application descriptor template

"How to restart an AIR application from code"

  • 2
    fYI: This doesn't work in debug mode. Because the code you posted was exact the same as we used already. Now I tried it in an installed instance and it did work! Thanks. – Gabriël Dec 03 '09 at 20:31