1 Reply Latest reply on May 16, 2006 1:44 PM by Rothrock

    Passing variables with attachMovie

    Level 7
      I'd like to create a photo gallery.
      To create the thumbnail I use these script and it works fine.
      BUT I can't pass to each thumbnail parameters, how can it be done?

      Here is the code :

      //***************************************************
      //init FILTERS
      import flash.filters.*;
      var ombre ropShadowFilter = new DropShadowFilter(0, 0, 0x725E47, .5, 10,
      10, 1, 4, false, false, false);
      var ombre2 ropShadowFilter = new DropShadowFilter(0, 0, 0x725E47, .8, 10,
      10, 1, 4, false, false, false);

      myMCL = new MovieClipLoader(); //define MovieClipLoader
      myListener = new Object(); //define listener

      //TEST WITH onLoadInit and onLoadComplete
      myListener.onLoadInit = function(targetMC){ //set the onComplete function
      on listener
      traceBox.text += "LOADING OF " + targetMC + " COMPLETE" + newline;
      targetMC.filters = [ombre];

      targetMC.onRollOver = function() {
      this.filters = [ombre2];
      };
      targetMC.onRollOut = function() {
      this.filters = [ombre];
      };

      targetMC.onPress = function() { //define onPress within
      function
      traceBox.text += newline + "REF= " + ref; // IT DOESN'T WORK VAR REF IS
      UNDEFINED ?

      }
      }


      //****************************
      function initClips(){
      for (i=0; i<result.length; i++){
      //PARAMETERS WORK FOR _Y and _X
      // BUT myNAME VAR DON'T
      valeurs={myName:"douhou",_y:50,_x i*50)}; //Parameters
      this.attachMovie("img", "vignette" + i, i,valeurs);
      //attach the movie
      myPath="lowjpg/"
      this["vignette"+i].ref = 45; // I INTEND TO PASS THE VARIABLE, NEITHER
      WORK ?
      myMCL.loadClip(myPath+ result + ".jpg" , this["vignette"+i]); //load
      images into clip result is an array defining files (jpg)
      }
      }
      //****************************
      myMCL.addListener(myListener); //associate listerer with
      MCL object
      initClips(); //call the function below