Hey,
I am working on a game which also contains a quiz. For the quiz the questions and answers are pulled from a xml. The problem is the it always loads the first question in the xml first and i would like this to be more random.
var questions:Array=new Array();
var answers:Array=new Array();
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, loadXML);
loader.load(new URLRequest("sample.xml"));
trace(score);
function loadXML(e:Event):void
{
var myxml = new XML(e.target.data);
var loop = score;
for (var i= 0 ;i<(loop);i++){questions[i]=myxml.ques[i].q1;
answers[i]=[myxml.ques[i].op1,myxml.ques[i].op2,myxml.ques[i].op3];
}
gotoAndPlay(currentFrame + 1);
}
stop();
This is the code that loads the xml
I tried this but it didn’t work I used 5 but this could also be math.random and (loop + i)
var myxml = new XML(e.target.data);
var loop = score;
for (var i= 5 ;i<(loop + 5);i++){questions[i]=myxml.ques[i].q1;
answers[i]=[myxml.ques[i].op1,myxml.ques[i].op2,myxml.ques[i].op3];
Anyone got any idea
this is the tutorial that was used http://flashbynight.com/tutes/quiz/
Thanks