8 Replies Latest reply on Sep 5, 2008 5:21 PM by kglad

    Giving Links To Dynamically Created MC

      Hi, I've been working on a semi-dynamic portfolio for my personal work. It combines a .swf and an XML file to create a bunch of little boxes, containing thumbnails, images, and links, all dynamically generated. Everything works fine except the link. Here is the ActionScript:

      var boxes = new Array();
      var myXml = new XML();
      boxY = 30;
      myXml.ignoreWhite = true;
      myXml.onLoad = function() {
      for (var i = 0; i<this.firstChild.childNodes[1].childNodes.length; i++) {
      boxY = boxY+45;
      boxes .projectName.text = myXml.firstChild.childNodes[1].childNodes.attributes.pTitle;
      boxes .thumb.loadMovie(myXml.firstChild.childNodes[1].childNodes.attributes.thumb);
      boxes .projectBtn.onRelease = function() {
      .attributes.link); // CONSOLE SAYS UNDEFINED

      Here is the XML:

      <?xml version="1.0" encoding="UTF-8"?>


      <project pTitle="Olde Oaks Golf Club" link="#" thumb="../img/oaks.gif" />

      <project pTitle="Trans/mission" link=" http://www.westwardmotion.com/projects/films/transmission.html" thumb="../img/transmission.jpg" />

      <project pTitle="Coming Soon" link="#" thumb="../img/placeholder.jpg"/>


      I think the problem with the getURL() is that the variable i from the for loop changes several times, while the getURL() occurs on with the onClick function. Perhaps at the time of the onClick the variable is undefined. Is there a solution to give these buttons dynamic links? Thanks for helping a noob. It is very much appreciated.