2 Replies Latest reply on Nov 19, 2007 12:59 AM by Xavi Colomer

    Opening windows

    Xavi Colomer Level 1
      Hello people

      I've spend a lot of time searching how to open windows but I haven't finded anything.

      Please anyone can help me? I want to create a new Window with some mxml code inside wich I have already created. Flex 3 seems to not support this yet. I just want to know how can I load a swf inside a nativeWindow or Window from actionscript, all I got since now is an empty blank window.

      The code should start like this:
      var w:NativeWindow = new NativeWindow(new NativeWindowInitOptions());
      ...
      ...

      Other question

      Which is the best way to do that?
      - use nativeWindow as told before?
      - use window
      - create an mxml application and call it from "AS3" like app:Name_of_mxmlApplication
      (If tryed last one but when I tried to opened "initilialize", an error occurred)

      Thanks for your patience!

        • 1. Re: Opening windows
          dimpled
          By new window do you mean in the flex application or the browser?

          In the flex application:
          1. Create your public var in your variable definitions, like:
          import mx.managers.PopUpManger; // popup window class
          import objects.NativeWindow; //your nativewindow mxml file, wherever it may be
          public var nativeW:NativeWindow = new NativeWindow(); // instantiate the popup var

          2. Pop up your window:
          public function showNativeWindow():void {
          nativeW = NativeWindow(PopUpManager.createPopUp(this, NativeWindow, true));
          // you could assign variables, like nativeW.myCustomVar = "value";
          PopUpManager.centerPopUp(nativeW);
          }

          3. Close the file in your mxml: PopUpManger.closePopUp(this);
          or from the parent app: PopUpManager.closePopUp(nativeW);


          to open a new browser window, use execute:

          public function gotoURL():void {
          var url1:String = new String();
          url1 = " http://www.google.com";
          ExternalInterface.call("window.open", url1, "_blank", "width=350,height=500"); //the last part is options for the window via javascript
          }

          • 2. Re: Opening windows
            Xavi Colomer Level 1
            Dimpled, Thanks for your answer,

            Flex Builder 3 Beta
            Working on AIR Desktop applications

            Finally found this is the best option to create the window:


            How Do you use PopUpManager,

            import flash.display.NativeWindow;
            var nw:NativeWindow = new NativeWindow(new NativeWindowInitOptions());
            nw.visible = true;

            Nativewindow is lighter (weight) than window.

            Anyone knows how to put mxml component inside the new window?