# Mc.addchild(mc) problem see code

**URL:** <https://forum.kirupa.com/t/mc-addchild-mc-problem-see-code/287831>\
**Category:** Uncategorized\
**Created:** [May 6, 2009, 8:12pm UTC](https://forum.kirupa.com/t/mc-addchild-mc-problem-see-code/287831 "2009-05-06T20:12:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ozkanb](https://avatars.discourse-cdn.com/v4/letter/o/b4bc9f/32.png) [@ozkanb](https://forum.kirupa.com/u/ozkanb)\
**Post date:** [May 6, 2009, 8:12pm UTC](https://forum.kirupa.com/t/mc-addchild-mc-problem-see-code/287831/1 "2009-05-06T20:12:57Z")

</div>

hi,

i want to make 4 buttons (movieclip+text) with a for iteration.  
first i make the movieclips(rectangles) and then i do  
movieclip.addchild(textfield)

here is my one and only code:

```auto

package {
    import flash.display.*;
    import flash.text.*;
    import flash.events.*;

    public class Document extends flash.display.MovieClip {

        public function Document() {
            var hoofdmenuTeksten:Array = new Array("STUBRU", "SPORZA", "KETNET", "KLARA");
            var mcsVanHoofdmenu:Array = new Array();

            for (var i = 0; i < 4; i++) {
                mcsVanHoofdmenu.push(new MovieClip());
                
                mcsVanHoofdmenu*.graphics.beginFill(0x000000);
                mcsVanHoofdmenu*.graphics.drawRect(0, 0, 98, 25);
                mcsVanHoofdmenu*.graphics.endFill();
                mcsVanHoofdmenu*.x = 361 + 99 * i;
                mcsVanHoofdmenu*.y = -5;

                var myText:TextField = new TextField();
                myText.text = hoofdmenuTeksten*;
                myText.x = 361 + 99 * i;
                myText.y = 2;
                myText.selectable = false;

                var myFormat:TextFormat = new TextFormat();
                myFormat.font = "Verdana";
                myFormat.size = 12;
                myFormat.color = 0xFFFFFF;
                myFormat.bold = true;

                myText.setTextFormat(myFormat);
                
                mcsVanHoofdmenu*.addChild(myText);
                addChild(mcsVanHoofdmenu*);
            }
        }
    }
}

```

now, i get the text behind the movieclips, what’s the reason of this?

here a screenshot:  
 ![](http://img.photobucket.com/albums/v627/ozkanb/temp.png)  
thx for any help
