-
[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:
<data>
<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>
<head01>heads/wa01.jpg</head01>
<head02>heads/wa02.jpg</head02>
<head03>heads/wa03.jpg</head03>
<head04>heads/wa04.jpg</head04>
<head05>heads/wa05.jpg</head05>
</title>
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){
if(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.
-
Looking at this too long I slept on it and figured it out myself
DAH!:
myXML.onLoad = function(succes){
if(succes){
trace (state_no);
var root = this.firstChild;
nodes = root.childNodes;
myXML.firstChild.firstChild.isCDATA = true;
this.createEmptyMovieClip("head01",43,-45);
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.toString());
mc_allstates.head02_mc.loadMovie(subnodes[8].firstChild.toString());
mc_allstates.head03_mc.loadMovie(subnodes[8].firstChild.toString());
mc_allstates.head04_mc.loadMovie(subnodes[8].firstChild.toString());
mc_allstates.head05_mc.loadMovie(subnodes[8].firstChild.toString());
} else trace("Error loading XML document")
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|