Command Line Calls in Adobe Flash

安稳与你 提交于 2019-12-13 01:25:09

问题


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!


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/32125825/command-line-calls-in-adobe-flash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!