Da geh ich mal nicht weiter drauf ein...
Wen es interessiert:
ActionScript:
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import flash.events.ErrorEvent;
import flash.events.ProgressEvent;
import mx.controls.Alert;
private var _file:File;
private var _nativeProcessStartupInfo:NativeProcessStartupInfo
protected function openExe():void
{
this._nativeProcessStartupInfo = new NativeProcessStartupInfo();
this._nativeProcessStartupInfo.executable = this._file;
var process:NativeProcess = new NativeProcess();
process.start( this._nativeProcessStartupInfo );
}
// Event Listener
protected function errorListener(event:ErrorEvent):void
{
Alert.show("ERROR: " + event.text );
}
protected function button1_clickHandler(event:MouseEvent):void
{
this._file = new File();
this._file.addEventListener(Event.SELECT, selected);
this._file.browseForOpen("Open");
}
protected function selected(event:Event):void
{
this._file = event.currentTarget as File ;
openExe();
}
]]>
</fx:Script>
<s:Button label="Search Game" click="button1_clickHandler(event)" />
</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