1 Reply Latest reply on Feb 5, 2007 10:32 PM by Marghoob Suleman

    xml photogallery description problem plz help

    sundeep_02tv26
      hai to all
      i am working on xml photogallery in flash mx 2004
      here everything is working fine the thumbs, main images ok
      now what i want is when i click on the thumbs the desc for pics should be displayed in desc box which is on top layer.

      heregallery is gallery.xml which is in /gallery/gallery.xml

      here is the code:-
      pic_mc._visible = false;
      my_xml = new XML();
      my_xml.ignoreWhite = true;
      my_xml.load("gallery/gallery.xml.xml");
      my_xml.onLoad = function() {
      rootElement = my_xml.firstChild;
      children = rootElement.firstChild.childNodes;
      //adding the main image node
      mainImageNode = rootElement.childNodes[1].childNodes;
      trace("mainImageNode="+mainImageNode);
      descNode = rootElement.childNodes[2].childNodes;
      trace(desc);
      hspace = my_xml.firstChild.attributes.hspace;
      //trace("hspace="+hspace);
      vspace = my_xml.firstChild.attributes.vspace;
      //trace("vspace="+vspace);
      nofimagesperrow = my_xml.firstChild.firstChild.attributes.nofimagesperrow;
      //trace(nofimagesperrow);
      nofimagespercol = my_xml.firstChild.firstChild.attributes.nofimagespercol;
      //trace(nofimagespercol);
      startx = my_xml.firstChild.firstChild.attributes.starty;
      //trace("startx"=+startx);
      starty = my_xml.firstChild.firstChild.attributes.starty;
      //trace("starty"=+starty);
      m = nofimagesperrow*nofimagespercol;
      //trace(m);
      duplicateMovie();
      };
      function duplicateMovie() {
      l = children.length;
      for (var i = 0; i<l; i++) {
      pic_mc.duplicateMovieClip("pic_"+i, i*100);
      if (i<nofimagesperrow && i<nofimagespercol) {
      setProperty("pic_"+i, _x, i*hspace+10);
      setProperty("pic_"+i, _y, starty);
      }
      if (i>=nofimagesperrow && i>=nofimagespercol) {
      setProperty("pic_"+i, _x, i*hspace-400+10);
      setProperty("pic_"+i, _y, vspace-starty);
      }
      if (i>=nofimagesperrow*2 && i>=nofimagespercol*2) {
      setProperty("pic_"+i, _x, i*hspace-800+10);
      setProperty("pic_"+i, _y, vspace*2-starty*3);
      }

      this["pic_"+i].external_mc.loadMovie(children .attributes.thumb);
      this["pic_"+i].external_mc._alpha = 0;

      trace("mainImageNode"+i+mainImageNode
      );
      this["pic_"+i].image = mainImageNode .attributes.main;
      var text1:Array = new Array();
      text1
      = descNode .attributes.desc;
      trace(text1
      );
      }
      }
      this.onEnterFrame = function() {
      for (var i = 0; i<children.length; i++) {
      if (this["pic_"+i].external_mc._alpha<100) {
      this["pic_"+i].external_mc._alpha += 5;
      }
      if (this["pic_"+i].external_mc._alpha>100) {
      this["pic_"+i].external_mc._alpha = 100;
      delete this.onEnterFrame;
      }
      this["pic_"+i].onPress = function() {
      //getting the custom proprty, which is imageID
      var imageToLoad:String = this.image;
      trace(imageToLoad);
      _root.holder_mc.loadMovie(imageToLoad);
      _root.holder_mc._xscale = 65;
      _root.holder_mc._yscale = 65;
      _root.holder_mc._x = 440;
      _root.holder_mc._y = 38;
      _root.desc_txt.text = text ;---here i am getting error. any corrections plzzzzz .. it is displaying undefined in the textbox which is dynamic one its var and instance is desc_text
      trace("="+desc_txt);
      };
      }
      };

      here is xml file :-
      <?xml version="1.0" encoding="UTF-8" ?>
      - <photo >
      - <thumb nofimagesperrow="4" nofimagespercol="4" startx="10" starty="10">
      <pic thumb="humb/pic1.jpg" main="main/pic1.jpg" desc="this is 1 pic" />
      <pic thumb="thumb/pic2.jpg" main="main/pic2.jpg" desc="this is 2 pic" />
      <pic thumb="thumb/pic3.jpg" main="main/pic3.jpg" desc="this is 3 pic" />
      <pic thumb="thumb/pic4.jpg" main="main/pic4.jpg" desc="this is 4 pic" />
      <pic thumb="thumb/pic5.jpg" main=main/pic5.jpg" desc="this is 5 pic" />
      </thumb>
      </photo>