I got some of this right but im lost on the script in red below. I attached the files so you can see the error message. if you can explain what im doing wrong too that would be great so i can learn.
http://www.wisc-online.com/prototypes/JGame/shooter.zip
Code:var XmlId:String = new String(); //Arrays to hold question data var qst:Array=new Array([]); var ans:Array = new Array(); var val:Array = new Array(); var ObjTitle:String = new String(); var ObjIntro:String = new String(); //Holds question Length var arrarylength:Number = new Number(); var loader:URLLoader = new URLLoader(); loader.addEventListener(Event.COMPLETE, loadXML); loader.load(new URLRequest("2152.xml")); function loadXML(e:Event):void { XML.ignoreWhitespace=true; var xml=new XML(e.target.data); arrarylength=xml.question.length(); ObjTitle=xml.@Title; ObjIntro=xml.@Title; var i:Number = new Number(); i=0; //++++++++++++ BUILD A 2 DIM ARRAY ++++++++++++++++++++++ for (i=0; i<arrarylength; i++) { ans[i] = new Array(); val[i] = new Array(); } //+++++++++++++++++++ END +++++++++++++++++++++++++++++++ //++++++++++++++++ get answers ++++++++++++++++++++++++++ i=0; var j:Number = new Number(); var ValAttributes:XMLList=xml.question.answer.@correct; for each (var correct:XML in ValAttributes) { for(j=0;j<4;j++){ val[i][j]=unescape(correct); trace(val[i][j]); } i++ } //+++++++++++++++++++++ end =++++++++++++++++++++++++++++ //++++++++++++++++++ Get Questions ++++++++++++++++++++++ i=0; var QstAttributes:XMLList=xml.question.@txt; //trace(QstAttributes) for each (var txt:XML in QstAttributes) { qst[i]=unescape(txt); //trace("ij"); i++; } //++++++++++++++++++ End ++++++++++++++++++++++++++++++++ } stop();
xml Sheet
Code:<questionGroup Title="Name the Presidents" Intro="In this game, you will be asked to identify the U.S. President being described. Answer as quickly as possible to earn the most points. "> <question txt="I wrote a book rejecting the divinity of Jesus." ><answer correct="false" txt="Jimmy Carter"/><answer correct="true" txt="Thomas Jefferson"/><answer correct="false" txt="Barack Obama"/><answer correct="false" txt="Abraham Lincoln"/></question> <question txt="I had to borrow money to go to my own inauguration."><answer correct="false" txt="Rutherford B. Hayes"/><answer correct="false" txt="Abraham Lincoln"/><answer correct="false" txt="William J. Clinton"/><answer correct="true" txt="George Washington"/></question> </questionGroup>


Reply With Quote