Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Using attachMovie multiple times to create a tile background

Participant ,
Jun 06, 2014 Jun 06, 2014

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.pvar=i;

  btnX.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)

  }

  }

}

TOPICS
ActionScript
268
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 06, 2014 Jun 06, 2014

you're going to need 296 tiles and you're only creating 14. extend the for-loop.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 06, 2014 Jun 06, 2014

Thanks.

But my problem is that the code is not working at all? There might be some error in the code? I have doubts with this particular line?

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 06, 2014 Jun 06, 2014
LATEST

use trace(attX[this.pvar]) to see if a linkage id is being traced.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines