1 Reply Latest reply on Jan 26, 2010 3:11 AM by Dragos GEORGITA

    AIR and a Javascript function

    DARTHCYL0N Level 1

      i have been through about 7 pages of the forums looking for an answer to this one and I can't seem to find it, it seems relatively straight forward even with the security specifications.

       

      Alright ,

      Here is what I am trying to do ,

      I need to call a function in the parent frame or main window from a child frame .

       

      I know I hate using Iframes too but this project requires it so I am stuck with that one.

       

       

      Here is the frame

       

      <iframe src="" id="childFrame" name="childFrame" frameborder="0" scrolling="no" width="100%" sandboxRoot="serverroot.com"></iframe>

       

      Pretty basic but wanted to show it anyway

       

      the function in the main window or parent is as follows

       

      well say

       

      function testFunction()[

           alert("this works");

      }

       

      with the security protocols I have read it is written like this .

       

      var interface = {};
          interface.testFunction = function(){
           alert('This Works');
         }
         document.getElementById("childFrame").parentSandboxBridge = interface;

       

       

      In the child frame we call the function

       

      The basic function call would be

       

      parent.testFunction();

       

      with security its more like this

       

      window.parentSandboxBridge.testFunction();

       

      Nothing I do seems to work, if anyone has any clues or Ideas I would appreciate it , I am actually stumped on this simple function LOL .

       

      I guess everyone is allowed a humbling experience.

       

      Ray