2 Replies Latest reply on Nov 20, 2006 9:33 AM by >Vee<

    using substring to splice XML attribute

    >Vee< Level 1
      Ok. So I have only the concept down but not a clue how to execute it. Heres what I want to do: Use a string from my XML create mutliple substrings then feed them into a comboBox.
      Heres what I mean:
      <myXML>
      <menu itemSizes="Small+Medium+Large" itemName="My Name 0">
      <menu itemSizes="Medium+Large" itemName="My Name 1">
      <menu itemSizes="Medium+Large+Extra Large" itemName="My Name 2">
      </myXML>
      Now take itemSizes and use
      Small, Medium and Large as data and labels in a comboBox. This is how Im discecting the other attributes currently:
      myXML_xml.onLoad = function(success) {
      if (success) {
      var root:XMLNode = this.firstChild;
      for (var i = 0; i<root.childNodes.length; i++) {
      var menu:XMLNode = root.childNodes ;
      // I shortened this dramitically but i just wanted to show you how I was working with them
      menus.push({myName:menu.attributes.itemName, myName:menu.attributes.itemName});
      var tmp_mc = _root.attachMovie("item_mc", "item_"+i+"_mc", i, {_y:0});
      tmp_mc._x = original_x;
      original_x += tmp_mc._width+10;
      tmp_mc.name_txt.text = menu.attributes.itemName;
      };
      }
      }
      // I target my comboBox like this: tmp_mc.cb_mc
        • 1. Re: using substring to splice XML attribute
          neil manuell Level 1
          try this, its pretty much copied from the flash documentation.

          • 2. using substring to splice XML attribute
            >Vee< Level 1
            Thanks for replying.
            I used the code you provided and pluged it in. Now each cb loads the different content form the XML attribute. The wierd thing is that nothing is selected when it first loads up, for instance the list box is blank but the list has the correct options. I tired:
            tmp_mc.cb_mc.selectedIndex = 0;
            but nothing appears in the box. If I take the comboBox and place it directly on the stage it works fine. Im totally lost for ideas on this, I tried also making setting the cb to non-editable (I dont neeed it to be anyhow), yet the data is still not working. got any ideas?