0 Replies Latest reply on Sep 4, 2006 1:16 PM by bibberlam

    button script: creating a new empty mc

    bibberlam
      hello,

      I'm struggling with the following problem:

      I'm setting up a script wich can be used on a button_mc. When clicking on the button, a number of small photo's will be loaded in new created mc's. Behind those photo-mc's, there is a ghost mc wich will contain a script to load a new photo when clicking the photo-mc... But it doesn't work... I can't get the properties of the fresh loaded photo's. I need these properties to handle the size of the ghost mc behind the photo's.

      I use the next script: (aantal.txt is a document wich contains the number of wanted photo_mc's...)

      on (release){
      text = new LoadVars();
      text.load ("aantal.txt");
      text.onLoad = function(succes) {
      if(succes){
      maximum = this.txt;
      trace(maximum);
      }
      }
      //creeren van de kleine preview kadertjes
      i=1;
      X=50;
      this.onEnterFrame = function() {
      while(i!=maximum){
      this.createEmptyMovieClip("preview"+i, i);
      this.createEmptyMovieClip("preview_back"+i, i+maximum);

      this["preview"+i].loadMovie("photo8.jpg");
      this["preview"+i]._x=X;
      this["preview"+i]._y=50;
      this["preview_back"+i]._x=X;
      this["preview_back"+i]._y=50;


      this.onEnterFrame = function() {
      while(bytes!=totalbytes){
      bytes=this["preview"+i].getBytesLoaded();
      totalbytes=this["preview"+i].getBytesTotal();
      }
      widthx=this["preview"+i]._width;
      heighty=this["preview"+i]._height;
      trace(i);
      trace (widthx);
      trace (heighty);
      //trace (maximum);
      }

      this["preview_back"+i].beginFill(0xff0000,100);
      this["preview_back"+i].moveTo(0,0);
      this["preview_back"+i].lineTo(0,hoogte);
      this["preview_back"+i].lineTo(breedte,hoogte);
      this["preview_back"+i].lineTo(breedte,0);
      this["preview_back"+i].lineTo(0,0);
      this["preview_back"+i].endFill();
      i++;
      X+=155;
      }

      this["preview_back"+i].onRelease=function(){
      _root.createEmptyMovieClip("picture", 101);
      _root.picture._x=200;
      _root.picture._y=50;
      _root.picture.loadMovie("project00.jpg");
      }
      }
      }

      What's wrong?? can someone help me?