我正在使用Flash CC构建AIR应用程序,以便可以使用本机进程。在我将它集成到我的完整项目之前,我创建了一个小型测试项目,以确定它是否可行。我在Windows中尝试过,它不起作用。尽管如此,我转而使用Mac并在那里工作。AIR本机进程在Mac上运行,但不在Windows上运行
本机进程由按键触发。该文件作为Windows安装程序发布,而不是Air软件包。我已经确保在xml文件中包含extendedDesktop。我有双重检查文件路径。有没有其他原因,这是行不通的?
package {
import flash.display.MovieClip;
import flash.filesystem.File;
import flash.events.KeyboardEvent;
import flash.desktop.NativeProcess;
import flash.desktop.NativeProcessStartupInfo;
public class Main extends MovieClip {
var exe:File = new File("C:\Windows\System32\notepad.exe");
var nativeProcess:NativeProcess = new NativeProcess();
var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
var args:Vector.<String> = new Vector.<String>();
public function startProcess(event:KeyboardEvent):void
{
if (event.keyCode == 65) {
nativeProcessStartupInfo.executable = exe;
args.push("C:/Users/Tristan/Documents/TVCR/airTestFile.rtf");
nativeProcessStartupInfo.arguments = args;
nativeProcess.start(nativeProcessStartupInfo);
}
}
}
}
它是否在“测试电影”模式下工作?脚本似乎很好,所以我建议做一些调试。创建一个文本字段来输出日志信息,就像keypress触发事件一样,还可以尝试** ... **捕获** NativeProcess.start **以获取异常。 – Organis
本机进程在“测试影片”模式下不起作用。它们只在发布Windows安装程序时才起作用。我不确定如何为日志信息创建文本字段。你能指点我一个教程吗? – browntastic
对不起,我不明白...你不知道如何在库中创建一个** MovieClip **,如何设计一个** TextField **,如何将它们添加到主时间轴? – Organis