0 Replies Latest reply on May 3, 2007 2:46 PM by try_Ry

    Context menu with XML data

      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. For some reason flash will only read the bottom url regardless of how many items are in the xml doc.

      Any ideas?

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <item name1="Go to Google.com"/>
      <item link1=" http://www.google.com"/>
      <item name2="Go to hotmail.com"/>
      <item link2=" http://www.hotmail.com"/>


      var contextXML = new XML();
      contextXML.ignoreWhite = true;
      contextXML.onLoad = buildContextMenu;
      function buildContextMenu()

      var theMenu:ContextMenu = new ContextMenu();
      var xmlLength:Object = this.firstChild.childNodes;
      for(var i=0; i<xmlLength.length;i++) {

      var ob = new Object();
      var xmlPath = this.firstChild.childNodes ;
      ob.name1 = xmlPath.attributes.name1;
      ob.link1 = xmlPath.attributes.link1;

      ob.name2 = xmlPath.attributes.name2;
      ob.link2 = xmlPath.attributes.link2;

      ob.item1 = new ContextMenuItem(ob.name1, itemHandler, false, true, true);
      ob.item2 = new ContextMenuItem(ob.name2, itemHandler, false, true, true);

      ob.item1.onSelect = function(){
      getURL(ob.link1, "_blank");
      ob.item2.onSelect = function(){
      getURL(ob.link2, "_blank");

      theMenu.customItems.push(ob.item1, ob.item2);
      _root.menu = theMenu;