FORUMS: list search recent posts

Dynamic Flash Quiz using XML and AS2

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Joel Galvan
Dynamic Flash Quiz using XML and AS2
on Mar 6, 2009 at 6:12:42 am

Hello all!

I created a quiz insided a movie clip, that loads after the main movie starts.

The quiz starts like this:

On frame 1:

qList = new Array();
nbrUsed = 0;

loadNode = function(it)
if (it.nodeName == 'question') {
var qSet = new Array();
qSet.q = it.attributes['q'];
qSet.used = false;
qSet.ans_a = it.attributes['ans_a'];
qSet.ans_b = it.attributes['ans_b'];
qSet.ans_c = it.attributes['ans_c'];
qSet.ans_d = it.attributes['ans_d'];
qSet.ans_e = it.attributes['ans_e']; // just in case there are more than 4...
qSet.ans_f = it.attributes['ans_f'];
qSet.right = it.attributes['right'];
else if (it.nodeName == "questionList")
if (it.hasChildNodes()) {
for (var i = 0; i < it.childNodes.length; ++i)

function finishInit()
trace(qList.length + " questions loaded:");
maxscore = qList.length*10;
qList.sort(function() { return random(5) - 1;});
questionNbr = 0;

var myxml = new XML();

myxml.onLoad = function()
qList = new Array();



-On frame 2:

{if (questionNbr >= qList.length)

question = qList[questionNbr].q;
answera = qList[questionNbr].ans_a;
answerb = qList[questionNbr].ans_b;
answerc = qList[questionNbr].ans_c;
answerd = qList[questionNbr].ans_d;
right = qList[questionNbr].right;

-on frame 3:


-on frame 4 (here, the buttons and the dynamic text box connected with the script are shown here):

if (right eq choice) {
} else {

The next frames are frames with labels "right" "wrong" and "end"
each one with a script in a frame in the middle


score = 10;


score =5;

and the button answers are labeled: A, B, C, D for the button answers (where you click) and the answer next to them (Dynamic text boxes), are "answera", "answerb", "answerc", "answerd"

The "questions.xml" that loads in the first frame, it's where all the questions are. Something like this:

ans_a='meet friends'
ans_b='waste time'
ans_c='finding answers and meet cool people'
ans_d='play games'

When it finishes, it ends in a frame labeled "end" with a message.

The thing is that, if you didn't click the correct answers (lets say 3 of 7), that jumps to another frame besides the "end" (with the message "congratulations you passsed"), to another frame, lets say "finish" that says "i'm sorry, you failed".

I have tried a few things, but everytime it goes to the same "end", as I haven't been able to calculate the jump.

It seems so simple, but i can't crack it, and I have asked around a lot, and it's like if I'm asking in "Martian" or "Mercurian" language, as nobody answers me anything...

Any help would be greatly apreaciated!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved