osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Restarting an AIR desktop application


Hi Nemi,

Thank you.

I already implement a restart method that works based on Alex, Om and Hugo
tips.

For those who can be interested :

public  function restartApplication():void
{
   var applicationDescriptor:XML =
NativeApplication.nativeApplication.applicationDescriptor;
   var xmlns:Namespace = new Namespace(applicationDescriptor.namespace());
   var applicationName:String = applicationDescriptor.xmlns::filename;
   var nativeProcessStartupInfo:NativeProcessStartupInfo = new
NativeProcessStartupInfo();
   var nativeProcess:NativeProcess = new NativeProcess();
   var applicationExecutable:File;

   if (Capabilities.os.indexOf("Win") > -1)
   {
        applicationExecutable = new
File(File.applicationDirectory.nativePath + "/" + applicationName + ".exe");

   }else{
  
        applicationExecutable = new
File(File.applicationDirectory.nativePath.replace("Resources", "MacOS/" +
applicationName));
   }

   nativeProcessStartupInfo.executable = applicationExecutable;
   nativeProcess.start(nativeProcessStartupInfo);
   NativeApplication.nativeApplication.exit();
}



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/