Groups | Blog | Home
all groups > flash data integration > december 2005 >

flash data integration : Go to Next XML record in flash


DJClappton
12/28/2005 4:29:51 PM
Hi,

I'm new to Flash an XML intergration and what i would like to know is how do i
move to the next XML record type thing in flash?

I have it displaying the XML content in flash but i can't move to the next
record.
Example:

I have the "Name: David" displayed but i also have the "Name:Harry" in the
next record. How do i move from "David" To "Harry"?

Here is my Flash code:


function loadXML(loaded) {
if (loaded) {
_root.FMPDSORESULT =
this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.Last = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
_root.email= this.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
_root.Description=
this.firstChild.childNodes[0].childNodes[3].firstChild.nodeValue;
First_txt.text = _root.FMPDSORESULT;
Last_txt.text = _root.Last;
Email_txt.text = _root.email;
Description_txt.text= Description;
} else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("test2.xml");


And here is My XML code:


<?xml version="1.0" encoding="UTF-8" ?>
<FMPDSORESULT xmlns="http://www.filemaker.com/fmpdsoresult">
<ROW MODID="1" RECORDID="24">
<First_Name>David</First_Name>
</ROW>
<ROW MODID="0" RECORDID="25">
<First_Name>Harry</First_Name>
</ROW>
</FMPDSORESULT>

I'm sorry for the long winded explanation!

Many thanks

Joe
(please bare in mind i'm Fairly new to this )
Motion Maker
1/1/2006 5:17:40 PM
Bit difficult to envision your XML data structure but you can loop as shown
in documentation for XMLNode nextSibling:

for (var aNode:XMLNode = rootNode.firstChild; aNode != null; aNode =
aNode.nextSibling) {
trace(aNode);
}

You need to fill in the blank for rootNode.firstChild as it will depend on
your XML data structure and where you need to start in the XML tree.


--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
[quoted text, click to view]
Hi,

I'm new to Flash an XML intergration and what i would like to know is how
do i
move to the next XML record type thing in flash?

I have it displaying the XML content in flash but i can't move to the next
record.
Example:

I have the "Name: David" displayed but i also have the "Name:Harry" in the
next record. How do i move from "David" To "Harry"?

Here is my Flash code:


function loadXML(loaded) {
if (loaded) {
_root.FMPDSORESULT =
this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.Last =
this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
_root.email=
this.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
_root.Description=
this.firstChild.childNodes[0].childNodes[3].firstChild.nodeValue;
First_txt.text = _root.FMPDSORESULT;
Last_txt.text = _root.Last;
Email_txt.text = _root.email;
Description_txt.text= Description;
} else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("test2.xml");


And here is My XML code:


<?xml version="1.0" encoding="UTF-8" ?>
<FMPDSORESULT xmlns="http://www.filemaker.com/fmpdsoresult">
<ROW MODID="1" RECORDID="24">
<First_Name>David</First_Name>
</ROW>
<ROW MODID="0" RECORDID="25">
<First_Name>Harry</First_Name>
</ROW>
</FMPDSORESULT>

I'm sorry for the long winded explanation!

Many thanks

Joe
(please bare in mind i'm Fairly new to this )

AddThis Social Bookmark Button