1 Reply Latest reply on Jan 8, 2008 8:33 AM by tj3182

    XML Action Script Help

    tj3182
      Im taking over a job and I was given the original flash file that doesnt seem to be working properly.
      It a thumbnail menu that loads through xml...the images work fine but the Links & Titles do not load.
      Nor does the rollover effect. Here what I have.

      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;
      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].attributes.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].onRollOver = thumbs_line.thumbs['thumb'+t].attachMovie("thumbov_mc", "thumbov_mc", 10);
      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("border_grey", "border_grey", 10);
      thumbs_line.thumbs['thumb'+t].border_grey._x -= thumb_border;
      thumbs_line.thumbs['thumb'+t].border_grey._y -= thumb_border;
      thumbs_line.thumbs['thumb'+t].attachMovie("border_white", "border_white", 20);
      thumbs_line.thumbs['thumb'+t].border_white._x -= thumb_border-1;
      thumbs_line.thumbs['thumb'+t].border_white._y -= thumb_border-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);

      }


      thumbs_line.onMouseMove = function() {
      if (_xmouse>=thumbs_line.thumbs_bg._x and _xmouse<=thumbs_line.thumbs_bg._width and _ymouse>=thumbs_line._y and _ymouse<=thumbs_line._y+thumbs_line._height) {
      onRollOver = thumbs_line.thumbs['thumb'+t].attachMovie("thumbov_mc", "thumbov_mc", 10);
      onEnterFrame = function () {
      if (_xmouse<(gallery_width/2)-10 and thumbs_line.thumbs._x<thumbs_right_limit) {
      thumbs_line.thumbs._x -= int((_xmouse-thumbs_line.thumbs_bg._width/2)/(100-scroll_speed));
      if (thumbs_line.thumbs._x>thumbs_right_limit) {
      thumbs_line.thumbs._x = thumbs_right_limit;
      }
      }
      if (_xmouse>gallery_width/2+10 and thumbs_line.thumbs._x>thumbs_left_limit) {
      thumbs_line.thumbs._x -= int((_xmouse-thumbs_line.thumbs_bg._width/2)/(100-scroll_speed));
      if (thumbs_line.thumbs._x<thumbs_left_limit) {
      thumbs_line.thumbs._x = thumbs_left_limit;
      }
      }
      };
      } else {
      onEnterFrame = undefined;
      }
      };
      this["link"+t] = my_xml.childNodes[1].childNodes[t].attributes.link;
      this["the_target"+t] = my_xml.childNodes[1].childNodes[t].attributes.target;
      }



      XML File

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


      <options>
      <option gallery_width="730" gallery_height="450" max_thumb_height="96"/>
      <option scroll_speed="75" thumbs_space="0" thumb_border="1" image_border="2"/>
      <option fade_in_seconds="1.5" thumb_fade_seconds="1.5"/>

      </options>

      <gallery>
      <img small="../flash/hosts/images/pic7.jpg" title="Name 1" link="hosts.asp"/>
      <img small="../flash/hosts/images/pic1.jpg" title="Name 2" link="bio1.asp"/>
      <img small="../flash/hosts/images/pic2.jpg" title="Name 3" link="bio2.asp"/>
      <img small="../flash/hosts/images/pic3.jpg" title="Name 4" link="bio3.asp"/>
      <img small="../flash/hosts/images/pic5.jpg" title="Name 5" link="bio4.asp"/>
      <img small="../flash/hosts/images/pic6.jpg" title="Name 6" link="bio5.asp"/>
      <img small="../flash/hosts/images/pic8.jpg" title="Name 7" link="bio6.asp"/>
      <img small="../flash/hosts/images/pic9.jpg" title="Name 8" link="bio7.asp"/>
      </gallery>



      Thier is a dynamic Text field in the roll over effect that should contain the "title"

      the rollover MC name is: thumbov_mc

      the dynamic text field is labeled: title



      And the links are not working either?
      Does anyone see the problem?

      Thank You So Much for you help in Advance