SHOW:
|
|
- or go back to the newest paste.
| 1 | - | package ; |
| 1 | + | function onCompilerComboChange(event:Event):Void |
| 2 | {
| |
| 3 | - | import flash.Lib; |
| 3 | + | compilerPath = event.currentTarget.selectedItem.label; |
| 4 | - | import flash.filesystem.File; |
| 4 | + | updateSettings(); |
| 5 | - | import flash.desktop.NativeApplication; |
| 5 | + | |
| 6 | - | import flash.display.Sprite; |
| 6 | + | |
| 7 | - | import flash.Vector; |
| 7 | + | function onSourceCompileClick(event:MouseEvent) |
| 8 | - | import flash.events.Event; |
| 8 | + | |
| 9 | - | import flash.events.MouseEvent; |
| 9 | + | processReady = false; |
| 10 | - | import flash.events.InvokeEvent; |
| 10 | + | Alert.show("compiling source code...");
|
| 11 | - | import flash.events.ProgressEvent; |
| 11 | + | |
| 12 | - | import flash.media.Camera; |
| 12 | + | var file = File.applicationStorageDirectory.resolvePath(config.sourceFile); |
| 13 | - | import flash.events.NativeProcessExitEvent; |
| 13 | + | |
| 14 | - | import flash.filesystem.File; |
| 14 | + | var stream = new FileStream(); |
| 15 | - | import flash.filesystem.FileMode; |
| 15 | + | stream.open(file, FileMode.WRITE ); |
| 16 | - | import flash.filesystem.FileStream; |
| 16 | + | stream.writeUTFBytes(source.text); |
| 17 | - | import flash.desktop.NativeProcess; |
| 17 | + | stream.close(); |
| 18 | - | import flash.desktop.NativeProcessStartupInfo; |
| 18 | + | |
| 19 | - | /** |
| 19 | + | |
| 20 | - | * ... |
| 20 | + | var file:File = new File(compilerPath); |
| 21 | - | * @author Jan_Flanders |
| 21 | + | |
| 22 | - | */ |
| 22 | + | |
| 23 | processInfo.executable = file; | |
| 24 | - | class Main |
| 24 | + | processInfo.arguments = Vector.ofArray(config.compilerArgs); |
| 25 | - | {
|
| 25 | + | |
| 26 | - | static function main() |
| 26 | + | |
| 27 | var process:NativeProcess = new NativeProcess(); | |
| 28 | - | var app = NativeApplication.nativeApplication; |
| 28 | + | |
| 29 | process.addEventListener(ProgressEvent.STANDARD_INPUT_PROGRESS, inputProgressListener); | |
| 30 | - | app.addEventListener(InvokeEvent.INVOKE, function(e : InvokeEvent) |
| 30 | + | |
| 31 | process.addEventListener(NativeProcessExitEvent.EXIT, onCompileComplete); | |
| 32 | - | //var camera:Camera = Camera.getCamera(); |
| 32 | + | |
| 33 | - | var button = makeBtn('Welcome to AIR, please click me!',onClick);
|
| 33 | + | |
| 34 | - | button.x = NativeApplication.nativeApplication.activeWindow.width / 2 - button.width / 2; |
| 34 | + | |
| 35 | - | button.y = NativeApplication.nativeApplication.activeWindow.height / 2 - button.height; |
| 35 | + | |
| 36 | Alert.show("Cannot compile. NativeProcess is not Supported in this mode.");
| |
| 37 | - | var file = File.applicationStorageDirectory.resolvePath("getid.bat");
|
| 37 | + | |
| 38 | } |