0 Replies Latest reply on Oct 22, 2009 7:06 AM by TarunaR

    XML Gallery and Content

    TarunaR Level 1

      I am way too confused with this gallery...I want something like when i rollover my locations, it should show the title and detail from my XML. And when one click on "click" button, it should take to the frame 2 of the toolTipMC where i want to built a gallery. My loading for frame1 is working fine, all i am stuck with is the gallery. How to load the imgs_set array and etc of the particular location....Please HELP [my locations are inside "island" movieclip and are named loc1, loc2, respectively.] please HELP HELP HELP....


      My XML reads like this :-

       

      <locations>
          <location title="Location1" 
          detail="Here is the content "
          url="myhtml.com/html1.html">
          <images>
          <image url="images1/1.jpg"></image>
          <image url="images1/2.jpg"></image>
          <image url="images1/3.jpg"></image>   
          </images>   
          </location>
          <location title="Location2" 
          detail="Here is the content "
          url="myhtml.com/html2.html">
          <images>
          <image url="images2/1.jpg"></image>
          <image url="images2/2.jpg"></image>
          <image url="images2/3.jpg"></image>   
          </images>   
          </location>
      </locations>

       


      My AS2 Code :-

       

      mc = island;
      toolTipMC._visible = false;
      var x:XML = new XML();
      x.ignoreWhite = true;

       

      var imgs:Array = new Array();
      var titles:Array = new Array();
      var details:Array = new Array();
      var urls:Array = new Array();
      var imgs_set:Array = new Array();
      var whoIsOn:Number;

       

      x.onLoad = function(success) {
          var locs:Array = this.firstChild.childNodes;
          var imgs:Array = this.firstChild.firstChild.firstChild;
          for(j=0;j<locs.length;j++) {
             
              imgs_set["loc"+(j+1)] = imgs[j].childNodes;
              titles["loc"+(j+1)] = locs[j].attributes.title;
              details["loc"+(j+1)] = locs[j].attributes.detail;
              urls["loc"+(j+1)] = locs[j].attributes.url;
             
              for(i=0;i<imgs_set.length;i++) {
              urls.push(imgs_set[i].attributes.url);
          }
             
              //trace(imgs[0].childNodes);
              //trace(imgs_set[0]);
             
          }
         
      }

       

      x.load("data.xml");

       

      for (i in mc) {
         
          if (typeof (mc[i]) == "movieclip" && i != "click") {
             
              myBtn = mc[i];
              myBtn._alpha = 0;
              this.useHandCursor = false;
                     
              myBtn.onRollOver = function() {
                 
                 
                      this.useHandCursor = false;
                     
                      //toolTipMC.img.imgHolder.loadMovie(images[this._name]);
                      toolTipMC.tip.text = titles[this._name];
                      toolTipMC.detail.text = details[this._name];
                      toolTipMC._visible = true;
                     
                      //this._alpha=40;
                                     
                 
                 
                 
                 
              };
             
              myBtn.onRollOut = function() {
                  //toolTipMC._visible = false;
                  this._alpha=0;
                  myColor.setRGB(oldColor);
              };
              myBtn.onPress = function() {
                 
                      myUrl = urls[this._name];
                      toolTipMC._visible = true;
                      slider.setValue(100);
                      this._alpha=0;
                     
                      //getURL(urls[this._name], "_blank");
               
              }
          };
      }

       

      toolTipMC.click.onRelease = function() {
          toolTipMC.gotoAndStop(2);
          //trace(imgs);
          trace(imgs_set[loc1]);

       

           imgHolder.loadMovie(urls[0]);
          caption.text = captions[0];
          whoIsOn = 0;

         
          toolTipMC.img.imgHolder.loadMovie(images[this._name]);
      }

       

      toolTipMC.previous.onRelease = function() {
          if(whoIsOn > 0) {
              whoIsOn--;
              holder.loadMovie(urls[whoIsOn]);
              caption.text = captions[whoIsOn];
          }
      }

       

      toolTipMC.next.onRelease = function() {
          if(whoIsOn < urls.length-1) {
              whoIsOn++;
              holder.loadMovie(urls[whoIsOn]);
              caption.text = captions[whoIsOn];
          }
      }