# Code to change the depth of a sprite/Movieclip?

**URL:** <https://forum.kirupa.com/t/code-to-change-the-depth-of-a-sprite-movieclip/249076>\
**Category:** flash\
**Created:** [January 15, 2008, 1:28am UTC](https://forum.kirupa.com/t/code-to-change-the-depth-of-a-sprite-movieclip/249076 "2008-01-15T01:28:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sargeonline](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@sargeonline](https://forum.kirupa.com/u/sargeonline)\
**Post date:** [January 15, 2008, 1:28am UTC](https://forum.kirupa.com/t/code-to-change-the-depth-of-a-sprite-movieclip/249076/1 "2008-01-15T01:28:38Z")

</div>

Hey,

Is there actionscript code to change the depth of a sprite on the stage?

I’m currently working on a small little project where I have 4 circles rotating around. When objectB hits objectA I want objectB to appear in front so I want that to change depths to the highest depth. Then later on in the animation I want objectC to appear in front of objectB and so on. Creating a 3d illusion of the 2d sprite rotating around.

Any examples too would be excellent.

Cheers!
