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());
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.