2

使用 Adob​​e AIR 为 Windows 创建屏幕保护程序在技术上是否可行?

4

2 回答 2

3

A work around is to host a .swf within a Windows form exe. I currently do this with C#/.Net 4.0. First you need to configure the .exe to behave as a screensaver. When you are done, you need to rename your .exe to .scr. Within the windows form, you need to embed a Flash Active X Object, then set the windows form to borderless etc.

If needed, the .swf can communicate to the .scr via the fscommand call. I for example, listen for the mouseMove event, within the .swf, then tell the .scr to close via fscommand.

There is a free utility that converts .swf files to screensavers called InstantStorm, but I personally prefer the Windows form method, as it allows more control.

Embedding the flash object

Windows form to screensaver

于 2012-11-30T23:31:25.867 回答
2

是的。

您可以做的是使用-captive-runtime-target 包编译您的 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;
                }
            }
    }
于 2013-11-27T22:00:37.867 回答