Hello,
I’m trying to create a context menu where you right click over a flash object and it will display links to external websites. The catch is I need to have the links stored in a XML doc for easy access. Onecommoncode helped with setting up this script but for some reason flash will only read the bottom url regardless of how many items are in the xml doc.
Any ideas?
contextmenu.xml
<?xml version=“1.0” encoding=“ISO-8859-1”?>
<menu>
<item desc=“Go to Google.com” link=“http://google.com” />
<item desc=“Go to hotmail.com” link=“http://hotmail.com” />
</menu>
AS/
var contextXML:XML = new XML();
contextXML.ignoreWhite = true;
contextXML.load(“contextmenu.xml”);
contextXML.onLoad = function() {
var theMenu = new ContextMenu();
theMenu.hideBuiltInItems();
var xmlLength:Object = this.firstChild.childNodes;
for(i=0;i<xmlLength.length;i++) {
var ob:Object = new Object();
var xmlPath = this.firstChild.childNodes*;
ob.desc = xmlPath.attributes.desc;
ob.link = xmlPath.attributes.link;
ob.item = new ContextMenuItem(ob.desc, onSelect, false, true, true);
ob.item.onSelect = function(){
getURL(ob.link, “_blank”);
}
theMenu.customItems.push(ob.item);
}
_root.menu = theMenu;
}