0

我正在使用以下代码段来创建带纹理的背景。

tileBG = function () {

tile_width = 7.75;
tile_height = 7.75;

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_width*x;
bg._y = tile_height*y;
}

}


};

tileBG(); 

我遇到的问题是模式/teture 出现在一切之上(我猜这是因为:getNextHighestDepth())。当我设置较低的深度时,例如 2,由于重复效应而失败,如果我执行 2+x,它会失败,因为该层上方大约有 8 层,它们可能分配了一些相同的深度。

我想知道是否有人对此有解决方案,或者我是否可以强制我的顶层(8 左右)具有特定的深度,例如 100+ 或类似的深度。

4

1 回答 1

0

在您要附加图片的深度处创建一个空剪辑,并将其放置在位置 0x0。假设它将被称为“mcTexture”。

然后,您可以修改调用“attachMovie”的代码行:

bg = mcTexture.attachMovie("square", "bg"+x+y, mcTexture.getNextHighestDepth());
于 2012-08-16T15:48:57.400 回答