A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [RESOLVED] dynamic XML parse node HELP!

  1. #1
    AS3 N00B
    Join Date
    Feb 2002
    Location
    NYC
    Posts
    308

    resolved [RESOLVED] dynamic XML parse node HELP!

    Here is my XML layout:
    Actionscript Code:
    <xml>
       <seriesA>
          <chart_form>
             <total_return>75.41%</total_return>
          </chart_form>
       </seriesA>
    </xml>

    I usually do this:

    Actionscript Code:
    function ParseSeriesData(seriesInput:XML):void {
        stats.htmlText = seriesInput.seriesA.chart_form.total_return;
    }

    But I want to do something like this:
    Actionscript Code:
    var mynode:String = "seriesA";

    function ParseSeriesData(seriesInput:XML):void {
        stats.htmlText = seriesInput.mynode.chart_form.total_return;
    }

    Thanks in advance.
    -Neo

  2. #2
    Member
    Join Date
    May 2004
    Posts
    57
    Try:

    seriesInput[mynode].chart_form.total_return
    He took daddy's umbrella!

  3. #3
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    The livedocs list all the methods available for XML and XMLList, as well as having links to the E4X specification. here
    Use the child method.

    Code:
    stats.htmlText = seriesInput.child(mynode).chart_form.total_return;

  4. #4
    AS3 N00B
    Join Date
    Feb 2002
    Location
    NYC
    Posts
    308
    thank you again 5TonsOfFlax!
    -Neo

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