Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-04-2003, 01:32 AM   #1
toshesh
Registered User
 
Join Date: Jun 2003
Posts: 37
Default xml type question

Hi everyone,

I'm having trouble reading data from a php file, which echos some data in an xml format.

print "<dataset>";
$row = pg_fetch_row($result, 0); //connection part abbreviated
print "<data>";
print "<rownum>1</rownum>";
print "<kid>". $row[0] ."</kid>";
print "<mname>". $row[1] ."</mname>";
print "<gtype>". $row[2] ."</gtype>";
print "</data>";

print "</dataset>";

on the flash side the code should start working when i press a button but nothing seems to be occur. How can I read the data entered from php and display it in flash????

on (release) {
include("php_xml_hander.as");
dataXML = new XML();
dataXML.onLoad = convertXML;
dataXML.load("sendxml.php");
}

function convertXML() {

mainTag = new XML();
elementTag = new XML();
dataList = new Array();
elementList = new Array();
dlist = new Array();
mainTag = this.firstChild;

if (dataXML.loaded) {
if (mainTag.nodeName == "dataSet") {
dataList = mainTag.childNodes;
for (i = 0; i < dataList.length; i++) {
if (dataList[i].nodeName == "data") {
elementList = dataList[i].childNodes;
for (j = 0; j < elementList.length; j++) {
elementTag = elementList[j];
elementType = elementTag.nodeName;

if (elementType == "rownum")
rownum = elementTag.firstChild.nodeValue;

if (elementType == "kid")
kid = elementTag.firstChild.nodeValue;

if (elementType == "mname")
mname = elementTag.firstChild.nodeValue;

if (elementType == "gtype")
gtype = elementTag.firstChild.nodeValue;
}
// Adds the label and data to the URL.
dlist.push(rownum, kid, mname, gtype);
}
}
}
}
}
toshesh is offline   Reply With Quote
Old 06-05-2003, 08:19 AM   #2
spriggan
CyanBlue Groupie
 
spriggan's Avatar
 
Join Date: May 2002
Posts: 519
Default

Here are some usefull Turorials
http://www.kirupa.com/developer/acti.../scripting.htm
spriggan is offline   Reply With Quote
Old 06-05-2003, 11:18 AM   #3
fgf
Registered User
 
fgf's Avatar
 
Join Date: Jan 2003
Location: edinburgh
Posts: 673
Default

I notice you are missing

dataXML.ignoreWhite=true;

which will cause no end of problems.

Also if you put a trace in your onload handler function is it called?

fgf
fgf is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
My brain hurts (onClipEvent question) andrea_levin ActionScript 2.0 3 03-25-2004 04:23 AM


All times are GMT. The time now is 02:33 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.