0
votes

I'm having a very difficult time finding many resources available for Flash Builder 4.6 geared towards desktop application programming.

I'm trying to accomplish a simple (or at least I think simple) task. I have an application, and in the application is a button. When the user clicks the button, I want a new window to load, but not in the current window as a child; as a completely separate window.

I've managed to accomplish this once, but the code I was using gave a warning (from Adobe Flash Builder 4.6) that told me that it is best practice to use an "interface" as the new window is now a child of the window that opened it. (I have since lost this code as I've been trying other things, like ModuleLoader).

Basically my question is, can someone please provide an example of how to properly implement an interface in the way that 2 separate windowedapplications can be loaded and they can communicate with each other through events?

And as a bonus, if anyone can point me in the direction of a good resource, I'd appreciate that also (book or site). :) I have a Flex 4 book that I've read, and it has helped a lot with my understanding of the basic things, but is not geared towards AIR desktop programming (and had no mentions of interface).

Thank you for your time.

1
Thank you, the first example was extremely helpful and I now have it working, thanks!Lyynk424
If you have it working; please answer your own question. this would help people who come upon this question later.JeffryHouser

1 Answers

0
votes

How I solved this problem. This article helped: Dual Monitor Support in Flex Application.

After you have created your project in Adobe Flash Builder 4.6, go to File > New > MXML Component. Type in the details as you see fit best for your application, but under "Based on" field, put "spark.components.Window". Click "Finish" when you are done with all the details.

In your main application, use the following code to pull up the new Window Component you just created into a separate Window. For the purpose of this code, I will assume that your new window is located under "assets.components" and is called CompNewWindow. Replace these details with your own.

<s:Button x="0" y="0" label="Button" click="_loadNewWindow(event)" />

<fx:Script>
    <![CDATA[

        import assets.components.CompNewWindow;

        private var myNewWindow:CompNewWindow;

        private function _loadNewWindow(event:MouseEvent):void
        {
            if (!myNewWindow) {
                myNewWindow = new CompNewWindow();
                myNewWindow.addEventListener(Event.CLOSE, _onNewWindowClose);
                myNewWindow.open();
            }
         }

        private function _onNewWindowClose(event:Event):void
        {
            myNewWindow.removeEventListener(Event.CLOSE, _onNewWindowClose);
            myNewWindow = null;
        }

    ]]>
</fx:Script>