# \[mc\] replacing a movieclip without changing it's children/depth/tweens

**URL:** <https://forum.kirupa.com/t/mc-replacing-a-movieclip-without-changing-its-children-depth-tweens/304273>\
**Category:** flash\
**Created:** [February 4, 2010, 5:50pm UTC](https://forum.kirupa.com/t/mc-replacing-a-movieclip-without-changing-its-children-depth-tweens/304273 "2010-02-04T17:50:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roland684](https://avatars.discourse-cdn.com/v4/letter/r/3bc359/32.png) [@Roland684](https://forum.kirupa.com/u/Roland684)\
**Post date:** [February 4, 2010, 5:50pm UTC](https://forum.kirupa.com/t/mc-replacing-a-movieclip-without-changing-its-children-depth-tweens/304273/1 "2010-02-04T17:50:11Z")

</div>

I would like to be able to draw a simple box as a background/placeholder, dress it up with buttons and movie clips at design time, and at runtime call a function to replace the simple box with the new design. How would I go about doing this?

I have a graphic design that is too complicated to make with flash. So i made a piece of actionscript that can restyle any existing movieclip. This piece of code works.

It basically gets the coordinates of the specified mc, creates a new one in it’s place and deletes the original.

\*\*Unfortunately \*\*this also removes any nested movieclips and buttons and breaks animation tweens of this mc. So if the original mc would have a button on it and animates from left to right, the new one doesn’t.

[LIST]  
[\*]mc.clear(); looked very promising, but it only clears stuff you put on it at runtime while I need to clear the stuff from design-time. (= the simple box drawing object)  
[/LIST]

[LIST]  
[\*]Creating a movieclip with the same name, at the same depth doesn’t seem to work.  
oldbox.parent.createEmptyMovieClip(oldbox.\_name, oldbox.getDepth());  
The old movieclip keeps existing and neither of them animates.  
[/LIST]  
So I’m searching for a way to replace a movieclip or clear it’s content at runtime.

Or am I thinking in the wrong direction and are there other ways to restyle a movie clip?
