Adobe Air ScreenSaver: How to make use of windows settings button

Jan 07, 2009

I'm working on a screen saver for cooporate use that I've choosen to use Adobe Air for. Once I started building and installing my first tests I ran into a few things I didn't like when clicking the preview and settings buttons in the display properties of Windows. I decided to open up a small number of choices to the users by actualy giving them a "User Options" window. Windows is kind enough to pass some arguments along, so this was actualy pretty easy.

/c = Settings Mode
/p = A preview mode
/s = Run as Screen Saver (when you click preview or computer times out)

Step one was to create a listener set. In my case I put this in my top level application instead of my EnvironmentControl.as [in my Model-Glue-Flex framework] because I wanted to keep the entire app from initializing for a settings mode.

private function onPreInitialize():void {
      NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, onArgumentsPassed);
}

private function onArgumentsPassed(e:InvokeEvent):void {
      if (e.arguments.indexOf("/p") != -1) {
            this.exit();
      } else if (e.arguments.indexOf("/c") != -1) {
            this.settingsMode = true;
      }
}

You'll notice that I have exited the screen saver on the preview mode. I did this because I found it annoying that windows would auto-launch the screen saver both on entering the tab in display properties as well as after saving and closing the settings window; These are the only two instances that the "/p" comes up in the arguments. The preview mode is suppose to launch the screen saver into mini-mode inside the faux computer screen in the pop-up, but I'm not sure how to do this or care to at this point.

Comments

Iqbal Singh

Iqbal Singh wrote on 01/27/09 6:53 AM

Can you give me source files for this
Iqbal Singh

Iqbal Singh wrote on 01/27/09 8:05 AM

How this.settingsMode = true; will work?
Russell Brown

Russell Brown wrote on 01/27/09 8:25 AM

All you need is right there in the post already. If your looking for the source code for the entire screen saver; I can't share that. The this.settingsMode is just a boolean variable. I look at that variable in my onCreationComplete function to decided which startup method to call. If it's true I create the settings window, if it's false I start the screen saver.
Iqbal Singh

Iqbal Singh wrote on 01/28/09 1:19 AM

I have done that, have you worked on customized installer for this AIR screen saver and able to show a small preview in screensaver tab of window?
Russell Brown

Russell Brown wrote on 02/01/09 5:14 PM

I haven't been able to figure out how to get the small preview mode to work, but I haven't spent tons of time on trying yet either.
Rick

Rick wrote on 02/03/09 2:05 PM

Is this a true screen saver that windows recognizes or an air application that runs fullscreen after an idle timer?
Russell Brown

Russell Brown wrote on 02/03/09 2:11 PM

It's a true and true screen saver. I was thinking about writing a blog post with my basic to-dos and learned lessons, so look for it in the near future... The basic portion is the executable. Simply copy-&-paste the executable and rename to ".scr". You can right click and install after that. In my case I wrote my own executable launcher that I package with the air installer, so the recipient user doesn't have to do anything but install.
Rick

Rick wrote on 02/03/09 4:23 PM

Aha very nice. Do you by chance know the equivalent to doing this on OSX?
Russell Brown

Russell Brown wrote on 02/03/09 4:28 PM

@Rick: Unfortunately I do not have an OSX box at my disposal to test/develop with.
Rick

Rick wrote on 02/03/09 4:34 PM

Should clarify: renaming the .app to .saver was not enough in the case of OSX, I'm digging around some more.

Write your comment



(it will not be displayed)



Subscribe to this comment thread