# \[AS2\]\[CS3\]Setting Depth before attachMovie

**URL:** <https://forum.kirupa.com/t/as2-cs3-setting-depth-before-attachmovie/281541>\
**Category:** programming\
**Created:** [February 10, 2009, 2:09pm UTC](https://forum.kirupa.com/t/as2-cs3-setting-depth-before-attachmovie/281541 "2009-02-10T14:09:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skribble](https://avatars.discourse-cdn.com/v4/letter/s/b487fb/32.png) [@Skribble](https://forum.kirupa.com/u/Skribble)\
**Post date:** [February 10, 2009, 2:09pm UTC](https://forum.kirupa.com/t/as2-cs3-setting-depth-before-attachmovie/281541/1 "2009-02-10T14:09:58Z")

</div>

**EXPLANATION:**

So I am loading everything in my game primarily with attachMovie(); and assigning them specific depths, and all has been going fine until now.

I made a “fade” movieclip so I can fade in levels/menus/etc and I load it with a depth far greater than anything on the screen, and while it works, there is a slight problem.

When I call something and set its depth, it takes 1 frame to process, so I get a “flicker” of things on screen, then the next frame they are where they are meant to be. This results in a very shoddy looking fade sequence.

**QUESTION:**

Is there a way to set the depth of a movieclip before/as it is attached to the stage, as to avoid the flickering effect?

Thanks!
