0 Replies Latest reply on Nov 17, 2010 8:40 AM by JasonRiceMedia

    new window communication with main application window problem

    JasonRiceMedia

      Javascript program.

           - most of the program runs outside of the application sandbox in:

           <iframe id="UI"
                      src="airIncludes/homeScreen.html"
                      sandboxRoot="http://localhost/"
                      documentRoot="app:/"
                      width="1000"
                      height="600"
                      frameborder="0"
                      scrolling="no"
                      style="width: 1000px; height:600px; padding:0px; overflow:hidden; margin:0px;">
                 </iframe>

       

           - the main application window also creates a new window triggered by the onload event of the body

               var options = new air.NativeWindowInitOptions();
               var options = new air.NativeWindowInitOptions();
               options.systemChrome = "none";
               options.type = "lightweight";
               var windowBounds = new air.Rectangle(100,100,300,650);
               var newHTMLLoader = air.HTMLLoader.createRootWindow(true, options, true, windowBounds);
               newHTMLLoader.load(new air.URLRequest("airIncludes/lungs.html"));
               newHTMLLoader.window.opener = window;

       

           - in the main application window there is this function:

                function loadPatientInfo(id){

                     air.trace("LOAD PATIENT INFO "+id);

                     try{

                          document.getElementById('UI').contentWindow.childSandboxBridge.loadPatient(id);

                     }catch(e){ air.trace(e); }

                }

                this function works as it should in the following cases:

                     - if called from a button in the main app window

                     - if called from a button in the iframe through the sandbox bridge

                this function DOES NOT WORK if called from the new side window using

                     window.opener.loadPatientInfo(id);

                     the first air.trace does return the 'id'.

                     after that this error is given

                         TypeError: Result of expression 'document.getElementById('UI').contentWindow.childSandboxBridge' [undefined] is not an object.

       

      what am i missing?   If calling this function from that location is not possible is there a work around?

       

      thank you in advance for any and all help.