5 Replies Latest reply on Oct 14, 2009 3:19 PM by kglad

    Button for loadURL from XML at random


      I need to create a button that will go to a random URL and that loads from and XML document.


      I have the basic visual effect complete:

      lb_1 is left button and rb_1 is right button.


      lb_1.onRollOver = over;

      lb_1.onRollOut = out;


      rb_1.onRollOver = over;

      rb_1.onRollOut = out;


      function over () {




      function out () {




      This is what I have on XML loading and random generation:


      var gallery_arr:Array;
      var gallery_xml:XML = new XML();
      gallery_xml.ignoreWhite = true;
      gallery_xml.onLoad = function() {
      var index:Number = new Number(0);
      var used:String = new String("used");
      gallery_arr = new Array(this.firstChild.firstChild.childNodes.length);
      for (var aNode:XMLNode = this.firstChild.firstChild.firstChild; aNode != null; aNode=aNode.nextSibling) {
      gallery_arr[index] = new Array(aNode.firstChild.childNodes.length);
      for (var subNode:XMLNode = aNode.firstChild; subNode != null; subNode=subNode.nextSibling) {
      gallery_arr[index][subNode.nodeName] = subNode.firstChild.nodeValue;
      gallery_arr[index][used] = false;
      function randomSelect(theNum:Number) {
      var myResult:Number = Math.floor(Math.random()*theNum);
      return myResult;
      This is my XML:
        </urls >
      </contributers >
      Basically, I need to get the action script all done and tie it to the button's onRollOver function.  I'm just not sure what to do next.
      Any help will be much appreciated.
      Thanks - JP