A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: Air - Modal/Slave - Window Test

  1. #1
    AS2 intolerant person
    Join Date
    Jan 2009
    Location
    Swansea
    Posts
    352

    Air - Modal/Slave - Window Test

    I have created a solution to the modal window problem with Air.

    To demonstrate what this script does, open your eclipse IDE, be if vanilla, zend or flash builder. Click window -> preferences.

    Now click outside of that new window, you will notice you cant, because that window must be closed before you can interact with the rest of the program.

    This is an important feature missing in Air, so I worked on a simple solution.
    The answer is fair straight forward really; create a window (preferably a native window and put a spark group inside it), set it to front of owner, make handler setting new window to active if owner window gets focus.

    So the attached library does this, making the fiddly bits a bit easier.

    to use, create an MXML component that extends RadixWindowContent, and put whatever you want inside it. Bare in mind that specifying the dimensions of the content will not work, because the window itself does that for you.

    in your code, import this:
    Actionscript Code:
    import com.codekestrel.radix.RadixWindow;

    And an example to open a window:
    Actionscript Code:
    var options:RadixWindowOptions = new RadixWindowOptions(nativeWindow, new CustomComponent());
                   
    options.type = NativeWindowType.UTILITY;
    options.modal = true;
    options.width = 300;
    options.height = 300;
                   
    var window:RadixWindow = new RadixWindow(options);
    window.activate();

    RadixWindowOptions is an extension of NativeWindowInitOptions.
    RadixWindow is an extension of NativeWindow.

    And that is it, the window will always be in front of the parent window and the parent window cannot be interacted with until the child window is closed.

    Remember, the window must be activated AFTER the owner is created, not after initialize.

    Further more, no visual glitches when trying to break it :P

    Zip attached, give it a go, tell me what you think.

    Flos
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center