A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] [CS4]XML @id Number to String

  1. #1
    Member
    Join Date
    Dec 2009
    Posts
    84

    resolved [RESOLVED] [CS4]XML @id Number to String

    I am having a problem that doesn't seem too difficult but is proving to be the bane of my existence. I have an XML file being imported and being used to populate a number of comboBoxes. Basically, here is my xml:

    PHP Code:
    <xml>
       <
    firstNode id "Text">
          <
    secondNode id "More Text">
             <
    thirdNode id "Even More Text">
                <
    fourthNode "111">
                   <
    stuff1></stuff1>
                   <
    stuff2></stuff2>
                   <
    stuff3></stuff3>
                   <
    stuff4></stuff4>
                </
    fourthNode>
             </
    thirdNode>
          </
    secondNode>
       </
    firstNode>
    </
    xml
    The whole process is working fine until I get to the fourthNode. I am using the @id for each node as the labels for each comboBox. The fourthNode, no matter what I do, populates in the comboBox as [object Object]. Here is how they are being added to the comboBoxes:

    PHP Code:
    for each(var fourth:XML in myXML..thirdNode.(@id == my_cb3.selectedLabel).fourthNode){
         var 
    obj:Object = new Object;
         
    obj.label fourth.@id;
         
    myArray.push(obj);
    }
    my_cb4.dataProvider = new DataProvider(myArray); 
    This process works fine for every instance before the fourthNode. I have tried "fourth.@id.toString();", I have tried creating a new string variable and using that as the obj.label, ect. If anyone has any ideas I would really appreciate it. Thanks.

  2. #2
    Senior Member
    Join Date
    May 2010
    Posts
    178
    I think you missed the id

    <fourthNode = "111">

    will be

    <fourthNode id = "111">


    it works here

    Poltuda

  3. #3
    Member
    Join Date
    Dec 2009
    Posts
    84
    Well, actually I only forgot the "id=" in my example. Turns out the problem was that I forgot to clear out the info already in my array by using "myArray = []". Stupid mistakes. Thanks though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center