3 Replies Latest reply on Jun 11, 2010 6:34 PM by Vista Den

    CS5:NativeProcessStartupInfo could not be found

    Vista Den

      I made a sample.

       

      ---------------------------------------------------------------

      package {
          import flash.desktop.DockIcon;
          import flash.desktop.SystemTrayIcon;
          import flash.display.Loader;
          import flash.net.URLLoader;
          import flash.display.NativeMenu;
          import flash.display.NativeMenuItem;
          import flash.display.MovieClip;
          import flash.desktop.NativeApplication;
          import flash.events.Event;
          import flash.events.IOErrorEvent;
          import flash.net.URLRequest;
          import flash.events.MouseEvent;
         
          import flash.filesystem.File;
          import flash.desktop.NativeProcessStartupInfo;
          import flash.desktop.NativeProcess;
         
          public class helloAIR extends MovieClip
          {
              private var file:File;
              private var nativeProcessStartupInfo:NativeProcessStartupInfo;
             
              public function helloAIR():void
              {
                  NativeApplication.nativeApplication.autoExit=false;
                 
                  var iconLoader:Loader = new Loader();
                  var iconMenu:NativeMenu = new NativeMenu();
                  var exitMenuItem:NativeMenuItem=iconMenu.addItem(new NativeMenuItem("Exit"));
                  exitMenuItem.addEventListener(Event.SELECT, onSelectHandle);
                 
                  if (NativeApplication.supportsSystemTrayIcon)
                  {
                      iconLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onIconLoaded);
                      iconLoader.load(new URLRequest("test.png"));
                      var sysIcon:SystemTrayIcon=NativeApplication.nativeApplication.icon as SystemTrayIcon;
                      sysIcon.menu=iconMenu;
                      sysIcon.tooltip = "AIR Application";
                  }

       

                  btn_drag.addEventListener(MouseEvent.MOUSE_DOWN, runDrag);
                 
                  file = File.applicationDirectory;
                  file = file.resolvePath("test");
                  nativeProcessStartupInfo = new NativeProcessStartupInfo();
                  nativeProcessStartupInfo.executable = file;
                  btn_np.addEventListener(MouseEvent.CLICK, runTest);
              }
             
              private function onSelectHandle(event:Event)
              {
                  NativeApplication.nativeApplication.icon.bitmaps=[];
                  NativeApplication.nativeApplication.exit();
              }

       

              private function onIconLoaded(evt:Event)
              {
                  NativeApplication.nativeApplication.icon.bitmaps=[evt.target.content.bitmapData];
              }
             
              private function runDrag(event:MouseEvent):void
              {
                  stage.nativeWindow.startMove();
              }
             
              private function runTest(event:MouseEvent):void
              {
                  var process = new NativeProcess();
                  process.start(nativeProcessStartupInfo);
              }
          }
      }

      ---------------------------------------------------------------

       

      The flash cs5 outputed an error:

       

      VerifyError: Error #1014: Class flash.desktop::NativeProcessStartupInfo could not be found.

       

      Anyone knows what's wrong with it?And how to fix it?

       

      Thanks!