# Depth: works in a difference way in Flash than on-line

**URL:** https://forum.kirupa.com/t/depth-works-in-a-difference-way-in-flash-than-on-line/227405
**Category:** flash
**Created:** [May 30, 2007, 12:57am UTC](https://forum.kirupa.com/t/depth-works-in-a-difference-way-in-flash-than-on-line/227405 "2007-05-30T00:57:51Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![costa](https://avatars.discourse-cdn.com/v4/letter/c/85f322/32.png) [@costa](https://forum.kirupa.com/u/costa)
#### Post date: [May 30, 2007, 12:57am UTC](https://forum.kirupa.com/t/depth-works-in-a-difference-way-in-flash-than-on-line/227405/1 "2007-05-30T00:57:51Z")

</div>

Dear all,

This is really weird. I have two categories of movie clips that I add to stage using addChildAt. Basically I establish which one has to go over (or “on” my english sucks) the other. I do it in this way

```auto
var numMC:Number = container.numChildren; 

If (depthMC == -1){
depthMC = 0;
}
else{
depthMC = numMC;
	}
container.addChildAt(DisplayObject(instance),depthMC); 

```

where depthMC is my var to establish the depth .

The funny part is that code works well on line but in Flash works in reverse, I mean those MCs that should go over are under. With this code, it works in Flash but in reverse on line

```auto
var numMC:Number = container.numChildren; 
if (depthMC == -1){
depthMC = numMC;
}
else{
depthMC = 0;
	}
container.addChildAt(DisplayObject(instance),depthMC);

```

Any explanation for that?. Any light in this world of darkness?

Thanks
