# addChild, setChildIndex and swapChildren; make mouse\_over'd child highest depth

**URL:** https://forum.kirupa.com/t/addchild-setchildindex-and-swapchildren-make-mouse-overd-child-highest-depth/325171
**Category:** flash
**Created:** [September 29, 2011, 6:53pm UTC](https://forum.kirupa.com/t/addchild-setchildindex-and-swapchildren-make-mouse-overd-child-highest-depth/325171 "2011-09-29T18:53:29Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![y0m4m4](https://avatars.discourse-cdn.com/v4/letter/y/4af34b/32.png) [@y0m4m4](https://forum.kirupa.com/u/y0m4m4)
#### Post date: [September 29, 2011, 6:53pm UTC](https://forum.kirupa.com/t/addchild-setchildindex-and-swapchildren-make-mouse-overd-child-highest-depth/325171/1 "2011-09-29T18:53:29Z")

</div>

i tried all 3 of these, and i get error  
ReferenceError: Error #1065: Variable TLFTextField is not defined.  
or  
TypeError: Error #1034: Type Coercion failed: cannot convert “instance207” to flash.display.DisplayObject.  
at menucaller/self\_overHandler()

```auto

        private function self_overHandler(event:MouseEvent):void
        {
            this.parent.addChild(event.target);
            //this.parent.setChildIndex(MovieClip(evt.target), (this.parent.numChildren - 1));
            //event.target.parent.swapChildren(event.target.name, event.target.parent.getChildAt(event.target.parent.numChildren - 1).name);
            return;
        }

```

the moused over object is not a tlf text field, it is a movie clip with a tlf text field in it  
i cant use classic dynamic text field because when i do the text inserted with actionscript disapears

also, why when i try to trace the name of the mous\_over’d object do i get “instance207”  
it has an instance name that i gave it in the properties panel
