A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: accessing XML node attributes

  1. #1
    AFX == P. Forsberg
    Join Date
    Nov 2001
    Posts
    439

    accessing XML node attributes

    I'm at ends with accessing my XML attribute data. Here is my xml:
    <bundles>
    <AZ>
    <Product_1 type="bundle" cost="50.00" />
    <Product_2 type="bundle" cost="75.00" />
    <Product_3 type="product" cost="22.00" />
    <Product_4 type="product" cost="186.00" />
    <Product_5 type="product" cost="125.00" />
    </AZ>
    </bundles>

    And my AS:
    code:

    var myxml = new XML();
    myxml.ignoreWhite = true;
    myxml.onLoad = function()
    {
    trace(this.firstChild.childNodes[0].firstChild.childNodes[0].firstChild.childNodes[0].attributes.cost);
    }

    myxml.load("bundleData.xml");


    I can't get anything to trace but undefined. I've tried most variants of the trace line as well.

    Any help would be greatly appreciated,
    1M.

  2. #2
    AFX == P. Forsberg
    Join Date
    Nov 2001
    Posts
    439

    got it

    trace(this.firstChild.childNodes[0].firstChild.attributes.cost);

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