all groups > flash data integration > november 2006 >
You're in the

flash data integration

group:

XML -> Flash (well PHP/MySQL too)


XML -> Flash (well PHP/MySQL too) locatorjg1
11/7/2006 12:00:00 AM
flash data integration:
I am totally lost and not sure where I went wrong. Let me start from the
begining.... I created a simple MySQL database and wrote a PHP file which in
turn is writing XML. So I called for that php file (using xmlData.load). I'm
able to display/read the first three nodes, but no matter what I do I can't get
the last two to display. What am I doing wrong, and what can I do to fix this?
I really want to better understand this...

Here is the what the PHP file displays when I view the source:
<?xml version="1.0"?>
<election>
<district>[B]Congress - 3rd[/B]</district>
<mug>http://www.newsdayinteractive.com/election/images/DavidMejias.jpg</mug>
<candidate><br>David Mejias (D, WF)<br>Peter King (R, I, C)</candidate>
<votes><br>467,483<br>370,987</votes>
<percentage><br>0<br>0</percentage>

</election>

-------------

Here is the AS I have calling the XML in:

function loadXML(loaded) {
if (loaded) {
_root.par = this.firstChild.firstChild.firstChild;
_root.district = par;
_root.mugShot = this.firstChild.firstChild.nextSibling.firstChild.nodeValue;
_root.cand = this.firstChild.firstChild.nextSibling.nextSibling.firstChild;
//
_root.votes = ?????????????????? // These are the two that I'm lost on????
_root.perct = ?????????????????? // These are the two that I'm lost on :(
//
name_txt.htmlText = _root.district;
placeHolder_mc.loadMovie(mugShot);
cands_txt.htmlText = _root.cand;
votes_txt.htmlText = _root.votes;
perct_txt.htmlText = _root.perct;
} else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("e_xml.php?race=3");



Thank you so much in advance!
Re: XML -> Flash (well PHP/MySQL too) superreeen
11/7/2006 8:26:36 PM
I think this should work:

_root.votes = this.firstChild.firstChild.nextSibiling.firstChild.nodeValue;
Re: XML -> Flash (well PHP/MySQL too) locatorjg1
11/7/2006 8:48:47 PM
Thanks so much for your response. I actually figured it out around 3am this
morning and realized I needed CDATA before my <br>'s. They were causing all
sorts of weird problems.... Works like a charm now...
AddThis Social Bookmark Button