all groups > flash actionscript > september 2005 >
You're in the

flash actionscript

group:

Bulding a flash app and need help.


Bulding a flash app and need help. krl
9/10/2005 10:59:03 PM
flash actionscript:
I am in the proccess of building a flash app for my youth group that will
display our current Bible reading plan.
What I want to do is read the information from an xml document and populate
the apporpriate text fields. This is the structure tat I'm using in my xml file:
<ReadingPlan>

<Entry uid="#">
<Date>
<DayOfWeek></DayOfWeek>
<Month></Month>
<Day></Day>
<Year></Year>
</Date>

<Scripture>
<Book></Book>
<Chapters></Chapters>
</Scripture>
</Entry>

</ReadingPlan>

I have loaded the xml file successfully, but I'm not sure how to search
through the entries and glean the information from them.
I have two buttons that will go forward an entry and backward and entry
respectively.

I am making a function that will populate the fields, but I don't know how to
access data in each field.
Say I want to get entry 25. Coincidentally the 25th entry would be the main
nodes 25th child. How do I get the other information?
Here is the code I have so far:

function display(identifier){
myNodeD = startP.childNodes[identifier].childNodes[0]
Pdate.text = myNodeD.childNodes[0].nodeValue;
Pdate.text += myNodeD.childNodes[1].nodeValue;
Pdate.text += myNodeD.childNodes[2].nodeValue;
Pdate.text += myNodeD.childNodes[3].nodeValue;

myNodeS = startP.childNodes[identifier].childNodes[1]
Pscript.text = myNodeS.childNodes[0].nodeValue;
Pscript.text = myNodeS.childNodes[1].nodeValue;

}
Thanks for any help.
krl
Re: Bulding a flash app and need help. NSurveyor
9/10/2005 11:45:44 PM
Say you have this xml:

<nodes>
<mynode>HI!</mynode>
</nodes>

and you load it into myXML. myXML.firstChild will be the "nodes" node. And
myXML.firstChild.childNodes[0] will be the "mynode" node. To get the content
out of mynode, you need to get it's firstChild (text inside a node is a child
node of that node) then you would use nodeValue. So, to get HI, you would use:

myXML.firstChild.childNodes[0].firstChild.nodeValue;
Re: Bulding a flash app and need help. krl
9/15/2005 12:00:00 AM
That sounds like a good idea.
Re: Bulding a flash app and need help. krl
9/15/2005 12:48:54 AM
I tried replying to this a couple days ago, but apparently it didn't work.
That was the problem that I had. I was successful in making it all work.
There's a little more I want to do with the program, but it's mostly simple (at
least in my head). In order to search to a certain day all I would have to do
was have a for loop that went through each record until the search criteria met
the data in the nodes. I am wondering in order to eliminate user input errors
and checking I was thinking of making drop-downs that the user could pick
elements from. Does anyone have any other ideas that might work better?
Re: Bulding a flash app and need help. NSurveyor
9/15/2005 10:40:04 AM
AddThis Social Bookmark Button