PDA

View Full Version : xml and AS3 question


olucas
11-05-2009, 03:25 AM
Hello, I was trying not to post something and figure it out on my own but, after hours and hours and days of study trying to figure this out and not, I have given in and really need some help!!

I have an XML document that has 25 different subjects and in each subject, 4 different pictures:

<subjects>
<subject>
<imgURL>images/1a.jpg</imgURL>
<imgURL>images/1b.jpg</imgURL>
<imgURL>images/1c.jpg</imgURL>
<imgURL>images/1d.jpg</imgURL>
</subject>

<subject>
<imgURL>images/2a.jpg</imgURL>
<imgURL>images/2b.jpg</imgURL>
<imgURL>images/2c.jpg</imgURL>
<imgURL>images/2d.jpg</imgURL>
</subject>

// and on for a total of 25

I have 2 groups of different buttons. The first group is a set of 4 buttons, one for each image in a single subject. When the user clicks btn1 then image 1a needs to display. When the user presses btn2 then image 1b displays, and so on.
The second group of buttons is a set of 2 btns: nextSubjectBtn and prevSubjectBtn. The names are pretty self explanatory but basically, when the user clicks nextSubjectBtn then I need the next subject from the xml to load and the 1 2 3 4 btns need to switch over to the images within the next subject. So when the user presses btn1 then image 2a shows up etc.

I have studied a ton of documents on XML but I have not been able to figure this out. Its probably something pretty simple involving one or more arrays and maybe a loop or two but I dont know what.

I have have all of the buttons programmed or at least recognized and ready for when I figure out what they are supposed to do. Right now they just have a trace.

Through help I have gotten from different documents and other programmers this is what I need to do but I need help on how:

Assign each of a buttons a value that will reference the picture URLs from the XML doc. Then create a variable with a value that references each subject 1 through 25. so when I click next subject it goes to the next subject in the xml doc.

How I should go about this?

Thanks for any help!