1 Reply Latest reply on Jun 28, 2007 7:26 PM by mr.nazarko

    sizing a movieclip with XML

    mr.nazarko
      hello,

      im trying to size a movie clip with xml----
      i want the movie clip named "holder" to adjust to the size of the photo that it is loading

      but am running into problems ---
      images are completely distorted

      below is my code: what am i doing wrong ?
      ------------------------------------------------------------------------------------------ -----------------------

      var x:XML = new XML();
      x.ignoreWhite = true;
      var urls:Array = new Array();
      var captions:Array = new Array();
      var w:Array = new Array();
      var h:Array = new Array();
      var whoIsOn:Number;

      x.onLoad = function(success) {
      var photos:Array = this.firstChild.childNodes;
      for (i=0; i<photos.length; i++) {
      urls.push(photos .attributes.url);
      captions.push(photos
      .attributes.caption);
      w.push(photos .attributes.width);
      h.push(photos
      .attributes.height);
      }
      trace(urls[0] + " - " + captions[0] + " - " + w[0] + " - " + h[0] );
      holder.loadMovie(urls[0]);
      holder._width = w[0];
      holder._width = h[0];
      nav.caption.text = captions[0];
      whoIsOn = 0;
      };

      x.load(" http://www.antonnazarko.com/DAVE/photoLIST.xml");


      nav.previous.onRelease = function() {
      if (whoIsOn > 0) {
      whoIsOn--;
      trace(urls[0] + " - " + captions[whoIsOn] + " - " + w[whoIsOn] + " - " + h[whoIsOn] );
      holder._width = w[whoIsOn];
      holder._width = h[whoIsOn];
      holder.loadMovie(urls[whoIsOn]);
      nav.caption.text = captions[whoIsOn];
      }
      };

      nav.next.onRelease = function() {
      if (whoIsOn < urls.length-1) {
      whoIsOn++;
      trace(urls[0] + " - " + captions[whoIsOn] + " - " + w[whoIsOn] + " - " + h[whoIsOn] );
      holder._width = w[whoIsOn];
      holder._width = h[whoIsOn];
      holder.loadMovie(urls[whoIsOn]);
      nav.caption.text = captions[whoIsOn];
      }
      };
      ------------------------------------------------------------------------------------------ -----------------------

      any help is appreciated,

      thank you!