A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [RESOLVED] Followup to CDATA and XML

Threaded View

  1. #1
    Join Date
    Apr 2007

    resolved [RESOLVED] Followup to CDATA and XML

    Turns out I need to load images with the last five nodes of my XML. Here is my XML:
    <title name="Washington">

    <date><![CDATA[<b>Primary Election | </b>August 17th]]></date>
    <incumbent><![CDATA[<b>Incombent | </b>names]]></incumbent>
    <challenger><![CDATA[<b>GOP primarycandidates | </b>names]]></challenger>
    <O8result><![CDATA[<b>2008 Presidential Result | </b>Obama 58%, McCain 40%]]></O8result>
    <partyreg><![CDATA[<b>Party Registration | </b>None]]></partyreg>
    <pop55><![CDATA[<b>55+ Population | </b>19.6 %]]></pop55>
    <overview><![CDATA[<p><b>Overview | </b>Intro<b>Key 50+ Issues | </b>Issues.</p>]]></overview>

    Here is my AS XML Load, just can't seem to get the sytax right. As you can see in the main MC mc_allstates I load the nodes for the "heads" into empty movie clips but not sure about my syntax.

    myXML.onLoad = function(succes){
    trace (state_no);
    var root = this.firstChild;
    nodes = root.childNodes;
    myXML.firstChild.firstChild.isCDATA = true;
    mc_allstates.Title_txt.htmlText = nodes[state_no].attributes.name;
    subnodes = nodes[state_no].childNodes;
    mc_allstates.date_txt.htmlText = subnodes[0].firstChild.nodeValue;
    mc_allstates.incumbent_txt.htmlText = subnodes[1].firstChild.nodeValue;
    mc_allstates.challenger_txt.htmlText = subnodes[2].firstChild.nodeValue;
    mc_allstates.O8result_txt.htmlText = subnodes[3].firstChild.nodeValue;
    mc_allstates.partyreg_txt.htmlText = subnodes[4].firstChild.nodeValue;
    mc_allstates.pop55_txt.htmlText = subnodes[5].firstChild.nodeValue;
    mc_allstates.overview_txt.htmlText = subnodes[6].firstChild.nodeValue;
    mc_allstates.head01_mc.loadMovie = subnodes[7].firstChild.nodeValue;
    mc_allstates.head02_mc.loadMovie = subnodes[8].firstChild.nodeValue;
    mc_allstates.head03_mc.loadMovie = subnodes[9].firstChild.nodeValue;
    mc_allstates.head04_mc.loadMovie = subnodes[10].firstChild.nodeValue;
    mc_allstates.head05_mc.loadMovie = subnodes[11].firstChild.nodeValue;

    } else trace("Error loading XML document")
    Last edited by AVaughn; 08-21-2010 at 10:00 AM.

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