Command Line Calls in Adobe Flash

2019-08-09 04:24发布

Is there a way to make a call to the command line, (On Debian) from ActionScript in Adobe Flash? For example, execute files:

python update.py

Steps for this on Windows would also be appreciated!

2条回答
欢心
2楼-- · 2019-08-09 05:12

OK.

I see I can substitute the value of the file variable for what ever I need executed.That's fine if I want to execute that file. What about a simple command like cd MyDir or mkdir ThisAndThat Just plain old passes to the shell will be great. I am also using GNU Gnash with an SFW.

查看更多
劫难
3楼-- · 2019-08-09 05:19

If you are using Adobe Air version 2.0.x on Linux, you can use the NativeProcess() class (assuming your update.py is flagged as executable (a+x):

var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo(); 
var file:File = File.applicationDirectory.resolvePath("update.py"); 
nativeProcessStartupInfo.executable = file; 
var processArgs:Vector.<String> = new Vector.<String>(); 
processArgs.push("AnUpdateArgument"); 
nativeProcessStartupInfo.arguments = processArgs; 
process = new NativeProcess(); 
process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData); 
process.start(nativeProcessStartupInfo); 
public function onOutputData(event:ProgressEvent):void 
{ 
    var stdOut:ByteArray = process.standardOutput; 
    var data:String = stdOut.readUTFBytes(process.standardOutput.bytesAvailable); 
    trace("Got: ", data); 
}

Communicating with native processes in AIR

Note: You can not do this via a browser based SWF

查看更多
登录 后发表回答