2

Is it technically possible to create a screen saver for Windows using Adobe AIR?

Pavel
  • 2,610
  • 3
  • 31
  • 50

2 Answers2

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

Aaron
  • 1,024
  • 11
  • 11
2

Yes it is.

What you can do is compile your AIR project with -captive-runtime OR -target bundle (Makes it a standalone .exe instead of .air file).

For windows, simply rename your .exe to .scr, right click and choose install or test.

If you want to set it up for configuration and preview modes, you can listen for the application invoke event:

    //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;
                }
            }
    }
BadFeelingAboutThis
  • 14,445
  • 2
  • 33
  • 40