2
我想知道它是否可以從空中應用程序獲取全屏快照。 我感興趣的功能類似於Windows中的PrintScreen按鈕,它可以拍攝所有屏幕(包括第三方應用程序窗口)的快照,而不僅僅是運行air應用程序的窗口。 如果它不是特定的空氣,並且flash/flex API可以提供這樣的功能,它也會很棒。 提前了很多。Adobe AIR桌面應用程序是否可以拍攝全屏快照(又名「打印屏幕」按鈕)
我想知道它是否可以從空中應用程序獲取全屏快照。 我感興趣的功能類似於Windows中的PrintScreen按鈕,它可以拍攝所有屏幕(包括第三方應用程序窗口)的快照,而不僅僅是運行air應用程序的窗口。 如果它不是特定的空氣,並且flash/flex API可以提供這樣的功能,它也會很棒。 提前了很多。Adobe AIR桌面應用程序是否可以拍攝全屏快照(又名「打印屏幕」按鈕)
退房this article,介紹了通過調用本機進程獲得截圖:牢記
import flash.filesystem.File;
import flash.events.NativeProcessExitEvent;
var process:NativeProcess;
if(NativeProcess.isSupported) {
var file:File = File.applicationDirectory;
var args:Vector.<String> = new Vector.<String>();
if (Capabilities.os.toLowerCase().indexOf("win") > -1) {
file = file.resolvePath("PATH/TO/WINDOWS/printscr");
//use your prefered screenshot tool here (e.g. https://code.google.com/p/screenshot-cmd/
//also setup the args as needed
} else if (Capabilities.os.toLowerCase().indexOf("mac") > -1) {
file = file.resolvePath("/usr/sbin/screencapture");
args[0] = "-i";
args[1] = "screencapture.png";
}
var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo.arguments = args;
nativeProcessStartupInfo.executable = file;
nativeProcessStartupInfo.workingDirectory = File.desktopDirectory;
process = new NativeProcess();
process.start(nativeProcessStartupInfo);
process.addEventListener(NativeProcessExitEvent.EXIT,done);
}else trace("NativeProcess NOT SUPPORTED!");
function done(e:NativeProcessExitEvent):void{
trace("screenshot comprete");
}
一個重要的事情是AIR device profile。 如果您最初是在ADL中測試的,請務必使用extendedDesktop
配置文件,否則NativeProcess.isSupported
將返回false
。
欲瞭解更多詳情請查看NativeProcess documentation和Communicating with native processes in AIR developer guide
的聯繫被打破;它只是重定向到該網站的主頁。 – Brian 2015-11-09 18:35:47
我已經使用[wayback machine](http://archive.org/web/)更新了鏈接並提供了更多詳細信息 – 2015-11-10 10:12:59