Attach and remove movieclips

Hi all and thanks 4 a great forum :slight_smile:

I´ve got a problem that is really bugging me. I´ve got a function “addNavSquare” which works fine. it attaches a moveclip to the root and the number of clips is controlled by a .xml file. The movieclips works as an “index” to show different images. it all works fine…

[COLOR=gray]function addNavSquare() {[/COLOR]
[COLOR=gray]for (var i = 0; i<total; i++) {[/COLOR]
[COLOR=gray]menuName = “menuSquare_”+String(menuCount);[/COLOR]
[COLOR=gray]menuDepth = this.getNextHighestDepth();[/COLOR]
[COLOR=gray]this[menuName]._number = menuCount;[/COLOR]
[COLOR=gray]this[menuName]._x = 210 + menuCount * 15 ;[/COLOR]
[COLOR=gray]this[menuName]._y = 120;[/COLOR]

But !

when i try to remove the movieclips using the code below it wpont work !?

[COLOR=gray]function removeNavSquare() {[/COLOR]
[COLOR=gray]trace (“deleted”);[/COLOR]
[COLOR=gray]for(var i = 0; i < menuCount; i++) {[/COLOR]

Í would be really greatful for any good tips or ideas !

Thanksalot Johan :puzzle: