0 Replies Latest reply on Mar 14, 2008 6:56 AM by tj3182

    XML Help Please

    tj3182 Level 1
      I have a flash xml file that shows thumbnails images.....My problem is i am having problems linking the image with the link it needs to go to when clicked on. Also I have a rollover movie clip I need to show when you rollover the thumbnail....


      View File Here


      heres my action script:
      Stage.align = "TL";
      Stage.scaleMode = "noscale";
      preloader._visible = true;
      thumbs_line._visible = false;


      import mx.transitions.Tween;
      import mx.transitions.easing.*;

      my_xml = new XML();
      my_xml.ignoreWhite = true;
      if (_parent.xml_file == undefined) {
      my_xml.load((String(_url.slice(0, (_url.length-3))))+"xml");
      } else {
      my_xml.load(_parent.xml_file);
      }
      my_xml.onLoad = function(ok) {

      if (ok) {
      process_xml();
      } else {
      trace("XML not loaded");
      }
      };

      function process_xml() {
      total_images = my_xml.childNodes[1].childNodes.length-1;
      title = my_xml.childNodes[2].childNodes.length-1;
      link = my_xml.childNodes[3].childNodes.length-1;
      gallery_width = Number(my_xml.childNodes[0].childNodes[0].attributes.gallery_width);
      gallery_height = Number(my_xml.childNodes[0].childNodes[0].attributes.gallery_height);
      max_thumb_height = Number(my_xml.childNodes[0].childNodes[0].attributes.max_thumb_height);
      thumbs_space = Number(my_xml.childNodes[0].childNodes[1].attributes.thumbs_space);
      thumb_border = Number(my_xml.childNodes[0].childNodes[1].attributes.thumb_border);
      image_border = Number(my_xml.childNodes[0].childNodes[1].attributes.image_border);
      fade_in_seconds = Number(my_xml.childNodes[0].childNodes[2].attributes.fade_in_seconds);
      fade_out_seconds = Number(my_xml.childNodes[0].childNodes[2].attributes.fade_out_seconds);
      thumb_fade_seconds = Number(my_xml.childNodes[0].childNodes[2].attributes.thumb_fade_seconds);

      fade_in_seconds += 0.01;
      fade_out_seconds += 0.01;
      thumb_fade_seconds += 0.01;

      thumbs_line._y = gallery_height-max_thumb_height-(4*thumbs_space);

      thumbs_line.thumbs_bg._width = gallery_width;
      thumbs_line.thumbs_mask._width = gallery_width;

      thumbs_line.thumbs_bg._height = max_thumb_height+thumbs_space*2+thumb_border*2;
      thumbs_line.thumbs_mask._height = max_thumb_height+thumbs_space*2+thumb_border*2;
      thumbs_line._visible = true;

      load_thumb(0);
      preloader._x = int((gallery_width-preloader._width)/2);
      preloader._y = int(thumbs_line._y/2-preloader._height/2);


      max_image_height = gallery_height-max_thumb_height-thumbs_space*6;
      {
      load_image(0);
      }
      }
      this["link"+t] = my_xml.childNodes[1].childNodes[t].link;
      function load_thumb(t) {
      thumbs_line.thumbs.createEmptyMovieClip('thumb'+t, thumbs_line.thumbs.getNextHighestDepth());
      thumbs_line.thumbs['thumb'+t]._y = thumbs_space+thumb_border;
      thumbs_line.thumbs['thumb'+t]._x = thumbs_space+thumb_border;
      if (t>0) {
      thumbs_line.thumbs['thumb'+t]._x = thumbs_line.thumbs['thumb'+(t-1)]._x+thumbs_line.thumbs['thumb'+(t-1)]._width+thumbs_spac e;
      }
      thumbs_line.thumbs['thumb'+t].image_number = t;
      thumbs_line.thumbs['thumb'+t].onRelease = function() {

      };
      tellTarget (thumbs_line.thumbs['thumb'+t]) {
      var loadListener:Object = new Object();
      loadListener.onLoadInit = function(target_mc:MovieClip) {
      preloader.visible = false;
      thumbs_line.thumbs['thumb'+t].attachMovie("Host_Over", "Host_Over", -1);

      if (target_mc._height>max_thumb_height) {
      ratio = target_mc._width/target_mc._height;
      target_mc._height = max_thumb_height;
      target_mc._width = int(target_mc._height*ratio);
      }
      thumbs_line.thumbs['thumb'+t].border_grey._width = target_mc._width+thumb_border*2;
      thumbs_line.thumbs['thumb'+t].border_grey._height = target_mc._height+thumb_border*2;
      thumbs_line.thumbs['thumb'+t].border_white._width = target_mc._width+thumb_border*2-2;
      thumbs_line.thumbs['thumb'+t].border_white._height = target_mc._height+thumb_border*2-2;
      if (t<total_images) {
      t++;
      load_thumb(t);
      }
      thumbs_width = thumbs_line.thumbs._width;
      thumbs_right_limit = 0;
      thumbs_left_limit = 0-thumbs_width+int(gallery_width-thumbs_space-thumbs_space);
      var thumb_fade_in:Tween = new Tween(target_mc, "_alpha", none.easeIn, 0, 100, thumb_fade_seconds, true);
      };
      var thumb_loader:MovieClipLoader = new MovieClipLoader();

      thumb_loader.addListener(loadListener);
      createEmptyMovieClip("img", 30);
      thumb_loader.loadClip(this.my_xml.childNodes[1].childNodes[t].attributes.small, img);
      thumb_loader.loadClip(this.my_xml.childNodes[3].childNodes[t].attributes.link);


      }
      this["link"+t] = my_xml.childNodes[3].childNodes.length-1;
      }