# Attached movie and Load Movie

**URL:** https://forum.kirupa.com/t/attached-movie-and-load-movie/188838
**Category:** flash
**Created:** [May 11, 2006, 8:34am UTC](https://forum.kirupa.com/t/attached-movie-and-load-movie/188838 "2006-05-11T08:34:27Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![jamojo](https://avatars.discourse-cdn.com/v4/letter/j/a6a055/32.png) [@jamojo](https://forum.kirupa.com/u/jamojo)
#### Post date: [May 11, 2006, 8:34am UTC](https://forum.kirupa.com/t/attached-movie-and-load-movie/188838/1 "2006-05-11T08:34:27Z")

</div>

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\_width_x;  
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

---

<div class="post-metadata">

### Author: ![jamojo](https://avatars.discourse-cdn.com/v4/letter/j/a6a055/32.png) [@jamojo](https://forum.kirupa.com/u/jamojo)
#### Post date: [May 12, 2006, 1:06am UTC](https://forum.kirupa.com/t/attached-movie-and-load-movie/188838/2 "2006-05-12T01:06:11Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)
#### Post date: [May 12, 2006, 1:08am UTC](https://forum.kirupa.com/t/attached-movie-and-load-movie/188838/3 "2006-05-12T01:08:27Z")

</div>

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

---

<div class="post-metadata">

### Author: ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)
#### Post date: [May 12, 2006, 1:11am UTC](https://forum.kirupa.com/t/attached-movie-and-load-movie/188838/4 "2006-05-12T01:11:50Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jamojo](https://avatars.discourse-cdn.com/v4/letter/j/a6a055/32.png) [@jamojo](https://forum.kirupa.com/u/jamojo)
#### Post date: [May 12, 2006, 1:34am UTC](https://forum.kirupa.com/t/attached-movie-and-load-movie/188838/5 "2006-05-12T01:34:37Z")

</div>

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

---

<div class="post-metadata">

### Author: ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)
#### Post date: [May 12, 2006, 1:39am UTC](https://forum.kirupa.com/t/attached-movie-and-load-movie/188838/6 "2006-05-12T01:39:12Z")

</div>

Welcome :cowboy:
