Einzelnen Beitrag anzeigen
Alt 21-11-2009, 18:09   #5 (permalink)
Nico B.
Neuer User
 
Registriert seit: Dec 2005
Ort: Oldenburg
Beiträge: 2.268
Da geh ich mal nicht weiter drauf ein...

Wen es interessiert:


ActionScript:
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
  3.                        xmlns:s="library://ns.adobe.com/flex/spark"
  4.                        xmlns:mx="library://ns.adobe.com/flex/halo"
  5.                       
  6.                       
  7.                       
  8.                        >
  9.     <fx:Declarations>
  10.         <!-- Place non-visual elements (e.g., services, value objects) here -->
  11.     </fx:Declarations>
  12.    
  13.    
  14.    
  15.    
  16.     <fx:Script>
  17.         <![CDATA[
  18.             import flash.events.ErrorEvent;
  19.             import flash.events.ProgressEvent;
  20.            
  21.             import mx.controls.Alert;
  22.            
  23.            
  24.            
  25.             private var _file:File;
  26.            
  27.             private var _nativeProcessStartupInfo:NativeProcessStartupInfo
  28.            
  29.            
  30.             protected function openExe():void
  31.             {
  32.                 this._nativeProcessStartupInfo = new NativeProcessStartupInfo();
  33.                 this._nativeProcessStartupInfo.executable = this._file;
  34.                
  35.                
  36.                 var process:NativeProcess = new NativeProcess();
  37.                 process.start( this._nativeProcessStartupInfo );
  38.             }         
  39.            
  40. // Event Listener
  41.            
  42.            
  43.             protected function errorListener(event:ErrorEvent):void
  44.             {
  45.                 Alert.show("ERROR: " + event.text );
  46.             }
  47.            
  48.            
  49.             protected function button1_clickHandler(event:MouseEvent):void
  50.             {
  51.                 this._file = new File();
  52.                 this._file.addEventListener(Event.SELECT, selected);
  53.                 this._file.browseForOpen("Open");
  54.             }
  55.            
  56.            
  57.             protected function selected(event:Event):void
  58.             {
  59.                 this._file =  event.currentTarget as File ;
  60.                 openExe();
  61.             }         
  62.  
  63.         ]]>
  64.     </fx:Script>
  65.    
  66.     <s:Button label="Search Game" click="button1_clickHandler(event)" />
  67.  
  68. </s:WindowedApplication>


Benötigt wird:

a) ein geändertes FlexSDK (mit air2.0)
b) die Application-descriptor Datei muss enthalten:
- <application xmlns="http://ns.adobe.com/air/application/2.0beta">
- <supportedProfiles>extendedDesktop</supportedProfiles>

Grüße, Nico
__________________
Mein Blog
Freue mich über jeden Besucher. :)
Nico B. ist offline   Mit Zitat antworten