Correct way to removeChild from objectContainer3D

Software: Away3D 3.x

Colir, Newbie
Posted: 14 December 2011 11:16 AM   Total Posts: 21

hi,
i try to remove the child of an objectContainer3d
my code look like this (‘holder’ is an objectContainer3D)

var children  holder.children;
var 
nbChild children.length;
for(var 
i:int nbChild i++){
   
var child holder.removeChild(children[0])    

but this throm me an error :

RangeError: Error #1125: L’index 2 est en dehors des limites 1.
(index 2 is outside of the limit 1)

Can you help me ?
thanks

 

   

DrMcCleod, Newbie
Posted: 14 December 2011 11:20 AM   Total Posts: 2   [ # 1 ]

Try:

var children  holder.children;

while(
children.length)
{
    holder
.removeChild(children[0]);
}

 

   

Colir, Newbie
Posted: 14 December 2011 12:10 PM   Total Posts: 21   [ # 2 ]

oh yes !
thanks man !

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X