3 Replies Latest reply on Jan 5, 2007 7:04 AM by NHankla

    Loading issues with XML

    NHankla
      Hello All,
      I am working with an XML and External JPG loader and it doesnt seam to want to work all the time.
      It works randomly loading different images. The code is as follows

      stop();
      myPhoto = new XML();
      myPhoto.ignoreWhite = true;
      myPhoto.load("bangorchamber2.xml");
      myPhoto.onLoad = function(success) {
      numimages = this.firstChild.childNodes.length;
      spacing = 180;
      for (i=0; i<numimages; i++) {
      this.picHolder = this.firstChild.childNodes ;
      this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, randRange(1, 10));
      this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", randRange(1, 10));
      this.thumbLoader.loadMovie(this.picHolder.attributes.thmb);
      this.thumbHolder.title = this.picHolder.attributes.title;
      this.thumbHolder.quote = this.picHolder.attributes.quote;
      this.thumbHolder._x = i*spacing;
      this.thumbHolder._rotation = randRange(-15, 15);
      holder = this.thumbHolder.attachMovie("template", "template"+i, i);
      holder.title_txt.text = this.thumbHolder.quote;
      this.thumbHolder.onRelease = function() {
      getURL(this.title);
      };
      }
      };
      function randRange(min:Number, max:Number):Number {
      var randomNum:Number = Math.round(Math.random()*(max-min))+min;
      return randomNum;
      }

      if you want to see the FLA file I can place a zip file up.
      An example of it can be found at
      www.bangorregion.com/dev/
      as you can see when u reload the page a different image loads.

      Thanks
      Nathan