How do I open a window outside of the application?

In our Flex AIR application, we have a problem that our main application window is rather narrow. This means that Alert dialogs are interrupted on both sides and the right-click menu is clipped. How can we make these windows not crop our main window?

+1


source to share


4 answers


Turn the main AIR window into an invisible transparent window and make the main window of your application a child of the invisible one. Then, when you launch your AIR application, make the invisible window sized to fit the desktop. You can then place as many windows and dialogs as you like on that desktop without worrying about getting cropped, as is the case with you now.

If you want to support multiple on-screen displays so that your visible application window can be outside from display to display, then make your invisible window the size of your entire graphics coordinate system so that it spans all display screens.



Once you go with the invisible windowing approach, you can achieve windowing behavior that is similar to native applications.

+2


source


How do you display alerts? If you use Alert.show () it will use the default width. However, you can work around this by creating an alert object, setting the width manually (or even dynamically) and then using the PopUpManager to show it, place it where you want, and hide it. This requires a little more code, but gives you a lot more flexibility.

Here's a small example:



<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" 
    creationComplete="creationCompleteHandler();">
    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import mx.managers.PopUpManager;

            private function creationCompleteHandler():void
            {
                var alert:Alert = new Alert();

                alert.width = 100;

                alert.text = "this Alert is\n100px wide";

                PopUpManager.addPopUp(alert, this);

                PopUpManager.centerPopUp(alert);

                Alert.show("this Alert uses the default width");
            }
        ]]>
    </mx:Script>
</mx:WindowedApplication>

      

+1


source


When using flash applications inside a flash player, windows cannot be displayed outside the scene. Thus, the only way to make this work is to make your application larger.

You could use flex / ajax bridge and call the javascript alert box instead, they won't be scene bound. But it wouldn't be tailored like all other apps, although it would take a little more work to get connected, especially if you are listening to the user clicking the OK button ...

0


source


I believe the dojo extensions for adobe air should be capable of doing what you need. Never used it myself and not sure what the tradeoff is, but it's worth a look.

http://sitepen.com/labs/dair/

0


source







All Articles