1 Reply Latest reply on Jun 13, 2008 3:42 PM by FlashTastic

    Loading XML into flash

      I'm a beginner in programming I have been having problems loading xml files into a blank

      look at the code I have written and give me pointers.

      import mx.xpath.XPathAPI;

      var aQuiz:Array = new Array();
      var xmlQuiz:XML = new XML();
      xmlQuiz.ignoreWhite = true;
      xmlQuiz.onLoad = function() {
      var question:Array = XPathAPI.selectNodeList(xmlQuiz.firstChild, "*/text");
      for (var i:Number = 0; i<question.length; i++) {
      var quizNode:XMLNode = question ;
      var quiz:Object = new Object();

      quiz.id = quizNode.attributes.id;
      quiz.text = XPathAPI.selectSingleNode(quizNode, "*/text").firstChild.nodeValue;


      function display ():Void{
      var textquestions:String = "";
      for (var i:Number=0; i<aQuiz.length; i++){
      var quiz:Object = aQuiz
      textquestions += +quiz.id+"."+" "+quiz.text;
      txt_question.html = true;
      txt_question.text = textquestions;

      the xml file looks like this

      <question id="1">
      <text>Which of the following computer components can be safely disposed of in regular trash?</text>
      <answer>Printer toner</answer>
      <answer>Laptop batteries</answer>
      <answer correct="true">None of the above</answer>

      <question id="2">
      <text>What key do you press to access Safe Mode when Windows 98 is booting?</text>
      <answer correct="true">F8</answer>


      can some one tell me what is wrong in my code that it can not display?