Attached movie and Load Movie

Hi everyone,

I’m using this script to tile background in a stage and its works:

tileBG = function () {
tile_width = 34;
tile_height = 34;
//
x_max = Math.round(Stage.width/tile_width);
y_max = Math.round(Stage.height/tile_height);
//trace(x_max);
//trace(y_max);
for (x=0; x<x_max; x++) {
for (y=0; y<y_max; y++) {
bg = _root.attachMovie(“square”, “bg”+x+y,this.getNextHighestDepth());
bg._x = tile_widthx;
bg._y = tile_height
y;
}
}
};
tileBG();

My problem is i created a blank movie clip instance to load a external swf file using this script and the loaded movie clip is behind the tile background:

_root.loader.loadMovie(“pw-forum.jpg”);

Also, i encountered this either i load a swf file of place any objects in the stage.

Thanks in advance

I tried what you said to me i used the script you gave me but when i test my movie, tileHolder only shows one instance and the loaded movie.

try tracing it to see if they are made:mountie:

You’ll have to use _root.tileHolder.getNextHighestDepth(); since the depth in the current scope (this) doesn’t change when creating movie clips in another timeline.

thanks TheCanadian. Yes, it is **_root.tileHolder.getNextHighestDepth(); **. Thank you.

Welcome :cowboy: