2 Replies Latest reply on Sep 14, 2007 5:08 AM by Sivakanesh

    XML and Flash

    Dionisus
      I'm working not so long with flash and I have an idea but do not know how to do it.
      My tusk is to use data from xml file in flash script.

      Summery
      I have a xml file for example asdf.xml with next content:


      <?xml version="1.0"?>
      <node1>1</node1>



      I need a flash action script that will do next:
      if value from <node1> (from xml file) == 1 then gotoAndPlay(1); else gotoAndPlay(10);

      Now if the value from <node1> will be 1 the script will have to go and play a movie clip if not go to and play another movie clip.

      I did something like this but it doesn't work properly. My scrip is :

      var myLoginReply = new XML();
      myLoginReply.load("asdf.xml");
      myLoginReply.onLoad = function(success) {
      //trace(this)
      if (success) {
      //vezi aici daca e bine targetat
      trace(this.firstChild.firstChild.nodeValue);
      trace(this.firstChild.nodeName);
      if (this.firstChild.nodeName == "node1" && this.firstChild.firstChild.nodeValue == "1") {
      gotoAndPlay(1);
      } else {
      gotoAndPlay(10);
      }
      } else {
      trace("Wrong XML file");
      }
      }

      The problem is that when I'm putting in this.firstChild.firstChild.nodeValue == "1" another value for example 2 or 3 or 100 the script will go, this means that it can not see the value from <node1>. The most interesting thing is when you put in staid or 1 put 0.

      I need your help in fixing this problem. PLS HELP ME