0 Replies Latest reply on Jul 26, 2007 9:01 AM by its_niebes

    Problem getting color from xml

    its_niebes
      hi! i have to make a xml menu in flash and everything was going ok to the time a had to get a different color for each link.

      Here's the actionscript:

      var dados:XML = new XML();
      dados.ignoreWhite = true;
      dados.load('menu.xml');
      dados.onLoad = function():Void {
      qtd = this.childNodes[0].childNodes.length;
      for (i=0; i<qtd; i++) {
      bt.duplicateMovieClip('bt'+i,_root.getNextHighestDepth());
      _root['bt'+i]._y += i*31;
      _root['bt'+i].t = this.childNodes[0].childNodes .childNodes[0].firstChild;
      _root['bt'+i].texto.text = _root['bt'+i].t;
      _root['bt'+i].link = this.childNodes[0].childNodes
      .childNodes[1].firstChild;
      _root['bt'+i].cor = this.childNodes[0].childNodes .childNodes[2].firstChild;
      //
      myColor = new Color(_root['bt'+i].fundo);
      myColor.setRGB(cor);
      //
      _root['bt'+i].onPress = function() {
      getURL(this.link);
      };
      _root['bt'+i].onRollOver = function() {
      this.gotoAndStop(2);
      };
      _root['bt'+i].onRollOut = function() {
      this.gotoAndStop(1);
      };
      }
      bt.unloadMovie();
      };

      And the xml code:

      <?xml version="1.0" encoding="UTF-8"?>
      <menu>
      <item>
      <texto>
      <![CDATA[QUEM SOMOS]]>
      </texto>
      <link>
      <![CDATA[ http://www.mxstudio.com.br
      </link>
      <cor>
      <![CDATA[0xff0000]]>
      </cor>
      </item>
      <item>
      <texto>
      <![CDATA[PRODUTOS]]>
      </texto>
      <link>
      <![CDATA[ http://www.mxstudio.com.br
      </link>
      <cor>
      <![CDATA[0xff0000]]>
      </cor>
      </item>
      </menu>



      can anyone help me with this?
      thank you all!