# How to arrange layer order in action script

**URL:** <https://forum.kirupa.com/t/how-to-arrange-layer-order-in-action-script/218268>\
**Category:** Uncategorized\
**Created:** [March 6, 2007, 8:26am UTC](https://forum.kirupa.com/t/how-to-arrange-layer-order-in-action-script/218268 "2007-03-06T08:26:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![capz\_man](https://avatars.discourse-cdn.com/v4/letter/c/eb8c5e/32.png) [@capz\_man](https://forum.kirupa.com/u/capz_man)\
**Post date:** [March 6, 2007, 8:26am UTC](https://forum.kirupa.com/t/how-to-arrange-layer-order-in-action-script/218268/1 "2007-03-06T08:26:01Z")

</div>

guys i have tiled a background image using the code bellow:  
\*  
import flash.display.BitmapData;  
\_root.createEmptyMovieClip(“tempMC”, 3, {\_alpha:0});  
var theLoader:MovieClipLoader = new MovieClipLoader();  
var theListener:Object = new Object();  
theLoader.addListener(theListener);  
theListener.onLoadInit = function(mc:MovieClip) {  
bitmapPic = new BitmapData(\_root.tempMC.\_width, \_root.tempMC.\_height);  
bitmapPic.draw(mc);  
\_root.tempMC.removeMovieClip();  
\_root.createEmptyMovieClip(“picMC”, 4);

```
_root.picMC.beginBitmapFill(bitmapPic);
_root.picMC.lineTo(0,0);
_root.picMC.lineTo(0,140);
_root.picMC.lineTo(Stage.width,140);
_root.picMC.lineTo(Stage.width,0); 
    
_root.picMC.endFill(); 

```

};

theLoader.loadClip(“bg\_header.gif”, \_root.tempMC);\*

and it was placed in the layer2.  
at first layer (layer1) which is on the top of layer2,i put the codes bellow to display the icon of my website:

\*import flash.display.BitmapData;  
\_root.createEmptyMovieClip(“tempMC3”,1, {\_alpha:0});  
var iconLoader:MovieClipLoader = new MovieClipLoader();  
var iconListener:Object = new Object();  
iconLoader.addListener(iconListener);  
iconListener.onLoadInit = function(mc3:MovieClip) {  
iconPic = new BitmapData(\_root.tempMC3.\_width, \_root.tempMC3.\_height);  
iconPic.draw(mc3);  
\_root.tempMC3.removeMovieClip();  
icon1.attachBitmap(iconPic, 2);  
};

iconLoader.loadClip(“icon.gif”, \_root.tempMC3);  
\*

but when it previewing, the icon appeared behind the repeat background, i don’t know why its happened, because i already put layer1(where the icon supposed be on the top) in the right place. please help me to figure it out. thanks.
