0 Replies Latest reply on Jan 23, 2008 12:19 PM by debriscreator

    XML and Flash

    debriscreator
      I'm having trouble creating a button in a flash movie that pulls a URL from an xml file.

      Here is my Action Script (bold blue text is what i'm having trouble with)
      ----------------------------------------------------------------
      stop();
      var nInterval = setInterval(Play, 9000);
      function Play() {
      clearInterval(nInterval);
      gotoAndPlay(_currentframe+1);
      }
      myXML = new XML()
      myXML.ignoreWhite = true
      myXML.load("ascolta.xml")
      myXML.ref = this
      myXML.onLoad = function(succes){
      if(succes){

      var root = this.firstChild
      nodes = root.childNodes
      for(var i=0; i<nodes.length; i++) {
      this.ref["Title_txt"+i].text = nodes .attributes.name
      subnodes = nodes
      .childNodes
      this.ref["heading"+i].text = subnodes[0].firstChild.toString()
      this.ref["URL"+i].text = subnodes[1].firstChild.toString()
      _root.yo = this.ref["URL"+i].text
      this.ref["article"+i].text = subnodes[2].firstChild.toString()

      }
      } else trace("Error loading XML document")
      }
      ---------------------------------------------------------------------

      below is my button code

      ---------------------------------------------------------------------
      on (release) { getURL(_root.yo); }

      ---------------------------------------------------------------------

      below is my xml file

      ---------------------------------------------------------------------

      <?xml version="1.0" ?>
      - <Widget>
      - <menu1 name="Menu Name 1">
      <Heading1>Heading 1</Heading1>

      <URL1>www.link1.com</URL1>

      <Article1>Article 1</Article1>

      </menu1>


      - <menu2 name="Menu Name 2">
      <Heading2>Heading 2</Heading2>

      <URL2>www.link2.com</URL2>

      <Article2>Article 2</Article2>

      </menu2>


      - <menu3 name="Menu Name 3">
      <Heading3>Heading 3</Heading3>

      <URL3>www.link3.com</URL3>

      <Article3>Article 3</Article3>

      </menu3>


      - <menu4 name="Menu Name 4">
      <Heading4>Heading 4</Heading4>

      <URL4>www.link4.com</URL4>

      <Article4>Article 4</Article4>

      </menu4>




      <Widget>
      ---------------------------------------------------------------------
      does anyone know why my button pulls an undefined link?

      thanks in advance - dave