This will be the third time I've posted this same question in
various ways. Having received no responses, I'm wondering if anyone
out there is actually using AIRMenuBuilder....but here goes anyway:
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 (A,B,C,D,E). The first four (A,B,C,D)
have submenus, but when the fifth (E) 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
air.ui.Menu.setAsMenu(root);
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
}
</script>
Snippet 2 from index.html:
<iframe
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 "E":
var menuName = "eMenu";
bridgeInterface.newMenu(menuName);
break;