3 Replies Latest reply on Jun 6, 2014 10:33 AM by kglad

    Using attachMovie multiple times to create a tile background

    Ron Colmen Level 2

      I'm want to tile a 700 x 700 area using attachMovie().

      The movieclips used for the attachMovie is 50 x 50

       

      This is the code. Something is wrong here.

       

      var NuX:Number=0;

      var NuY:Number=0;

      var btnX:Array=[gpat_btn0, gpat_btn1, gpat_btn2];

      var attX:Array=["pat0","pat1","pat2"];

      for(i=0;i<btnX.length;i++){

        btnX[i].pvar=i;

        btnX[i].onRelease = function(){

        NuX=NuY=0;

        for(j=0;j<14;j++){

        if(NuX>=650){

        NuX=0;

        NuY=NuY+50;

        }

        _root.movieC1.movieC2.clip0.attachMovie(attX[this.pvar], attX[this.pvar]+j, _root.movieC1.movieC2.getNextHighestDepth(), {_x:NuX, _y:NuY});

        NuX=NuX+50;

        //trace(NuX)

        }

        }

      }