技术上是否可以使用Adobe AIR为Windows创建屏幕保护程序?
答案 0 :(得分:3)
解决方法是在Windows窗体exe中托管.swf。我目前使用C#/。Net 4.0执行此操作。首先,您需要将.exe配置为屏幕保护程序。完成后,您需要将.exe重命名为.scr。在Windows窗体中,您需要嵌入Flash Active X对象,然后将窗体设置为无边框等。
如果需要,.swf可以通过fscommand调用与.scr通信。例如,我在.swf中监听mouseMove事件,然后告诉.scr通过fscommand关闭。
有一个免费的实用程序可以将.swf文件转换为名为InstantStorm的屏幕保护程序,但我个人更喜欢Windows表单方法,因为它允许更多的控制。
答案 1 :(得分:2)
是的。
您可以做的是使用 -captive-runtime 或 -target bundle 编译AIR项目(使其成为独立的.exe而不是.air文件)。
对于Windows,只需将.exe重命名为.scr,右键单击并选择安装或测试。
如果要为配置和预览模式进行设置,可以监听应用程序调用事件:
//put this in your app main constructor
NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, invokEventHandler, false, 0, true);
protected function invokEventHandler(e:InvokeEvent):void {
//you don't actually have to loop as it will always be the first argument
for each(var a:String in e.arguments) {
//p - Show the screensaver in the screensaver selection dialog box
if (a.indexOf("/p")) {
//do something different for preview mode
break;
}
//s - Show the screensaver full-screen
if (a.indexOf("/s")) {
//the main full screen mode
break;
}
//c - Show the screensaver configuration dialog box
if (a.indexOf("/c")) {
//show a configuration window
break;
}
}
}