Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Data Integration / November 2006



Tip: Looking for answers? Try searching our database.

XML -> Flash (well PHP/MySQL too)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
locatorjg1 - 07 Nov 2006 05:16 GMT
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!
superreeen - 07 Nov 2006 20:26 GMT
I think this should work:

_root.votes = this.firstChild.firstChild.nextSibiling.firstChild.nodeValue;
_root.perct = this.firstChild.firstChild.nextSibiling.firstChild.nodeValue;
locatorjg1 - 07 Nov 2006 20:48 GMT
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...
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.