I'm an RIA Developer who owns a motorcycle custom paint shop, who loves to race anything with wheels. I also enjoy woodworking, cooking, fine wines, liqueurs and dark beers. So if nothing else my blog should be eclectic.  

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

ColdFusion , Development , Adobe Flex , Adobe Air Add comments

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.

10 responses to “Adobe Air ScreenSaver: How to make use of windows settings button”

  1. Iqbal Singh Says:
    Can you give me source files for this
  2. Iqbal Singh Says:
    How this.settingsMode = true; will work?
  3. Russell Brown Says:
    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.
  4. Iqbal Singh Says:
    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?
  5. Russell Brown Says:
    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.
  6. Rick Says:
    Is this a true screen saver that windows recognizes or an air application that runs fullscreen after an idle timer?
  7. Russell Brown Says:
    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.
  8. Rick Says:
    Aha very nice. Do you by chance know the equivalent to doing this on OSX?
  9. Russell Brown Says:
    @Rick: Unfortunately I do not have an OSX box at my disposal to test/develop with.
  10. Rick Says:
    Should clarify: renaming the .app to .saver was not enough in the case of OSX, I'm digging around some more.

Leave a Reply





Powered by Mango Blog. Design and Icons by N.Design Studio