Good XML nodes for "flash cards"

Hidey ho, first time here, and I’m liking what I see so far. Very nice tutorials on the site. Wish I came here sooner!

So, as an utter newbie at XML, I am trying to teach myself some AS3 and XML integration by making a flash card program within Flash CS3. I’m not entirely sure what to do within Flash, but I’ll burn that bridge when I get there. For now, I want to set up an XML file that is conducive to flash cards.

After some poking around, I have decided to write the data in the following way:

 
<?xml version="1.0"?>
<quiz>
<question>
<questionText>The smallest unit structure of living things is the...</questionText>
<choice correct="no">mucous</choice>
<choice correct="no">nucleus</choice>
<choice correct="no">protein</choice>
<choice correct="yes">cell</choice>
</question>
<question>
<questionText>One Greek term meaning back is...</questionText>
<choice correct="no">lateral</choice>
<choice correct="no">ventral</choice>
<choice correct="yes">dorsal</choice>
<choice correct="no">anterior</choice>
</question>
<question>
<questionText>What is the enlargement of the extremities?</questionText>
<choice correct="no">centesis</choice>
<choice correct="yes">acromegaly</choice>
<choice correct="no">paralysis</choice>
<choice correct="no">dermatitis</choice>
</question>
</quiz>

So, my question is: Is this a good structure for a flash card? This will go into AS3, but naturally I welcome input from all angles. Who knows what I’ll use for flash cards later on? I’ve never constructed flash cards using XML before, so I’m a little hesitant.

Kevin

Sure, that’s a fine way to do it. :thumb:

Thank you for that. I want to make sure I do this right the first time. I haven’t gotten to the AS coding yet, but I predict a randomizer that opens a question node. If the answer picked has the attribute correct=“yes” then code is run that puts the question off to the side and moves on. Naturally, if the wrong answer is chosen, then the question is shuffled back in.

I’m sure I’ll be back when I hit my next obstacle, which will probaly be soon. Thanks again for taking a look at it.

Kevin

I would probably go attributes all the way tbh…


<questionText>The smallest unit structure of living things is the...</questionText>
<choice text="mucous" />
<choice text="nucleus" />
<choice text="protein" />
<choice correct="yes"text="cell"  />
</question>

You the correct=“no” is a bit redundant since you can search for yes… :open_mouth:

Oh, a good point. I’ll give that a shot.

I’m learning so much about XML efficiency already. Thank you kindly.

Kevin

<question>
<questionText>One Greek term meaning back is...</questionText>
<choices>lateral,ventral,anterior</choices>
<answer>dorsal</answer>
</question>

Wow, that is a lot simpler. But I don’t really know what to do with it. I suppose I will kludge through it when I get to the point where I am ready to parse the text, but I’m currently not sure what needs to be done.

I suppose I would assign each button to each of the words (stripping out commas). If a button is assigned to the <answer> node, then I call the function for choosing the right answer. I’ll take a look at this. Thanks very much.

Kevin

Just wondering if it would be even simpler if you wrote the XML file in such a way that the correct answer always appeared first in the list of choices.

Obviously, there would need to be some sort of shuffling when you displayed the question (people might catch on otherwise :slight_smile: ) but it would make your XML structure simpler - no need for an answer element.

u can use

String("lateral,ventral,anterior").split(",")

to get an array of those answers