[转]AIR中调用exe或者bat可执行文件
2016-03-09 00:00
435 查看
http://blog.csdn.net/zdingxin/article/details/6635274 前阵子做了个项目,刚好用到,记录下来。备注:使用的到类在SDK4.0以后新增,之前版本没有这样的功能。
import flash.desktop.NativeProcessStartupInfo; import flash.desktop.NativeProcess; private var file:File=new File(); private var nativeProcessStartupInfo:NativeProcessStartupInfo; private function callMyExe():void { //使用静态属性 NativeApplication.nativeApplication 获取应用程序的 NativeApplication 实例 //指定在关闭所有窗口后是否应自动终止应用程序。 /*当 autoExit 为 true(默认值)时,如果关闭了所有窗口,则应用程序将终止。调度 exiting 和 exit 事件。如果 autoExit 为 false,则必须调用 NativeApplication.nativeApplication.exit() 才能终止应用程序。*/ NativeApplication.nativeApplication.autoExit=true; //调用的文件 file=file.resolvePath("D:/workspace1/book/bin/play/Airbook.exe"); nativeProcessStartupInfo=new NativeProcessStartupInfo(); nativeProcessStartupInfo.executable=file; var process:NativeProcess=new NativeProcess(); process.start(nativeProcessStartupInfo); }
相关文章推荐
- AIR 教程:生成100%透明窗口,以及打包成.air
- canvas,paint的用法
- sleep和wait的区别
- Codeforces 651B Beautiful Paintings(贪心策略—两个优先队列实现)
- Apache启动提示 httpd: apr_sockaddr_info_get() failed for xxx
- Longtail Hedgehog(DP)
- Contains Duplicate II-副本包含
- 集训队专题(8)1007 Remainder
- 【LeetCode】219. Contains Duplicate II
- Codeforces--615B--Longtail Hedgehog(贪心模拟)
- Codeforces--615B--Longtail Hedgehog(贪心模拟)
- A - Again Twenty Five!【思维题】
- LINK1123:failure during conversion to COFF:file invalid or corrupt
- CodeForces 630A:Again Twenty Five!【水】
- 【LeetCode】217. Contains Duplicate
- Codeforces A. Again Twenty Five!【水】
- 1014. Waiting in Line (30)
- wait和notifyAll的方法使用案例分析
- Uva10976——Fractions Again?!
- ZOJ 3923 In the Rain(数学)