Skip navigation
Currently Being Moderated

Launching AIR app in background

Jul 28, 2010 12:14 PM

I have an AIR app that gets launched periodically via a command line call. It's a GUI based app that needs to be actually visible and showing, but I don't want it to interrupt whoever's logged in by putting the window in front of what they're doing. I've tried calling orderToBack(); on both the WindowedApplication and the NativeWindow to no avail. I'm sure this is a common occurrence, but I can't find anything in the documentation that works.

 
Replies
  • Currently Being Moderated
    Aug 4, 2010 10:08 AM   in reply to OzzyOGRicca

    Would http://livedocs.adobe.com/flex/3/langref/flash/display/NativeWindow.ht ml#visible solve your purpose or are you looking for something else ?

     

    -Rohit

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 4, 2010 10:56 AM   in reply to OzzyOGRicca

    You have a complete event in HTMLLoader class. Can't you just set the window visible property to true once you get his complete event, do the screenshot thing & again set the window visible property to false ? That way it would just be visible for flash of a second. Would that suffice ?

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 4, 2010 12:23 PM   in reply to OzzyOGRicca

    Would NativeWindow.orderToBack() work for your use case?

     

    Chris Thilgen

    AIR Engineering

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2010 1:49 PM   in reply to OzzyOGRicca

    I am able to open an AIR app in a minimized state by calling callLater(nativeWindow.minimize); in the WindowedApplication creationComplete event handler. The app blinks for a moment in its opened state, and then minimizes. In this case, the nativeWindow object is a property of WindowedApplication, not the stage. I am working this moment on getting the app to open in the background, and then use a SystemTrayIcon command to activate the application. Looks, however, like the NativeApplication.nativeApplication.activate() method is not honored in Windows XP. The app does not activate, and no Event.ACTIVATE event is dispatched. Good hunting.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 6, 2010 9:18 AM   in reply to OzzyOGRicca

    I have an application who need to be not visible, in the screen, and in the TaskBar. I use this code for my main app:

     

    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="absolute"
        backgroundAlpha="0.01"
        showFlexChrome="false"
        backgroundColor="0xFFFFFF"
        alwaysInFront="true"
        applicationComplete="{onAppComplete()}"
        themeColor="0x333333"
        >
       
        <mx:Script>
            <![CDATA[
                import mx.core.Window;
                import mx.controls.Alert;
                import flash.utils.setTimeout;
               
               
                private function onAppComplete() :void
                {
                    this.width = Capabilities.screenResolutionX;
                    this.height = Capabilities.screenResolutionY;
                   
                    var w:Window = new Window();
                    w.showStatusBar = false;
                    w.showTitleBar = false;
                    w.systemChrome = "none";
                    w.transparent = true;
                    w.setStyle("showFlexChrome", "false")
                    w.type = NativeWindowType.UTILITY;
                    w.title = "light";
                    w.addChild(new Hider());
                    w.open();
                    w.x = 0;
                    w.y = 0;
                    w.width = this.width
                    w.height = this.height
                    w.alwaysInFront = true;
                    w.move(0,0)
                    close();
                }
               
           
               
            ]]>
        </mx:Script>
       
    </mx:WindowedApplication>

     

    With this app descriptor:

    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <application xmlns="http://ns.adobe.com/air/application/2.0">
        <id>Cyanide</id>
        <filename>Cyanide</filename>
        <name>Cyanide</name>
        <version>v1</version>
        <!-- <description></description> -->
        <!-- <copyright></copyright> -->
        <!-- <publisherID></publisherID> -->
        <initialWindow>
            <content>[This value will be overwritten by Flex Builder in the output app.xml]</content>
            <systemChrome>none</systemChrome>
            <transparent>true</transparent>
            <visible>true</visible>
            <minimizable>false</minimizable>
            <maximizable>false</maximizable>
            <width>4000</width>
            <height>4000</height>
            <x>0</x>
            <y>0</y>
        </initialWindow>
        <supportedProfiles>extendedDesktop</supportedProfiles>
    </application>

     

    Tell me if it help you

     

    JG

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points