0 Replies Latest reply on Jan 22, 2009 5:40 AM by htmlkman

    Security violation creating new root menu

      Once I've created a root menu with AIRMenuBuilder, can I replace it with another? For example, my initial menu has 5 horizontal, top-level items. The first four have submenus, but when the fifth is selected, I'd like to overwrite the initial horizontal menu with a new one.

      The menus are created from JSON files, and the onSelect events are handled by Javascript. Running into the "Adobe AIR runtime security violation for JavaScript code in the application security sandbox," I created a parent sandbox bridge. The value of the new JSON file is successfully passed (and displayed in alerts), but I'm still getting a security violation and the new menu does not appear. Relevant snippets below.

      Thanks in advance for any suggestions you could offer.

      Snippet 1 from index.html:

      <script type="text/javascript">
      var root = air.ui.Menu.createFromJSON ("menus/rootmenu.js");
      air.ui.Menu.setAsMenu (root);

      var bridgeInterface = {};
      var newRootMenu = bridgeInterface.newRootMenu;
      bridgeInterface.newMenu = function(newRootMenu){
      var menuSource = "menus/" + newRootMenu + ".js";
      alert(menuSource); // displays properly, with correct values
      root = air.ui.Menu.createFromJSON(menuSource);
      alert('About to put up a new menu...'); // never displays, security violation must be line above
      alert('Well, we tried putting up a new menu, but...'); // never displays

      function engageBridge(){
      document.getElementById('contentArea').contentWindow.parentSandboxBridge = bridgeInterface;
      alert('Bridge is engaged!'); // displays properly

      Snippet 2 from index.html:
      id="contentArea" name="contentArea" bgcolor="white" width="100%" height="98%"
      src=" http://192.168.x.x/local/ui.html" sandboxRoot=" http://192.168.x.x/local/"
      documentRoot="app:/sandbox/" ondominitialize="engageBridge()"></iframe>

      Snippet from print.js:

      case "Payroll":
      var menuName = "payrollMenu";