PDA

View Full Version : addChildAt not working: RangeError: Error #2006



rib
May 12th, 2009, 12:56 PM
i simply load a playermenu from the library and then attach the whole player_menu to the stage.
when doing it with addChild it works, however when i specify a index it reports that error. (i need to use it because i want to control the indexing of movieclips)
i am just not able to add a child with addChildAt, whats the error here?



//menu
var player_menu:MovieClip = new MovieClip();
var player_menu_sub:playermenu = new playermenu();
player_menu.addChild(player_menu_sub);
player_menu.y=174;
this.addChildAt(player_menu, 6);
output.text=this.getChildIndex(player_menu).toStri ng();

dandare
January 28th, 2010, 01:43 PM
I run into the same problem and I think it is a bug in documentation. See http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/DisplayObjectContainer.html#addChildAt(), I left there a comment.