Keep track of the added meshes into an Array or Vector and use it to clear.
If you would add the meshes into a container3D you could then parse over the 
container.children

Fabrice


On Apr 18, 2010, at 8:33 PM, Dimi wrote:

> Hi all.
> 
> I have a problem with "removeChild" command in a scene.
> 
> What i have is 3 button that calls for three different models.
> I added 1 fourh button to try some code around.
> 
> the buttons works great and add the objects to the stage but ofcourse
> when you call the second and the third they stack upon eachother.
> 
> So in the 4th button i made this code to try around alittle.
> 
> myScene.removeChild(cube);
> 
> this one do remove the cube i have attached to the stage.
> to add the object i use the code inside a button click.
> 
> myScene.addChild(cube);
> 
> since i have 3 object i want a automatic function that check if there
> is anything in the scene before i add the new object. I figure i could
> do that with a simple "while"
> 
>       while(myScene.numChildren > 0) {
> 
>               myScene.removeChildAt(0);
>       }
> 
> 
> That while loop do remove something but not the cube.  Because when i
> run it i cant navigate the cube anymore however i can still see it.
> 
> I figure there is something i do not understand with the scene.
> i also tried to remove the whole view but then i got some caos with
> outpu error 1009 property or method = null.
> 
> so how is the hieraki?
> 
> view
>   - scene
>        - cube
> 
> or do i miss something?
> 
> why the code is myScene.addChild(cube); is because i add a new scene
> to the view
> 
>               viewport = new View3D();
>               viewport.camera = camera;
>               viewport.x = 500;
>               viewport.y = 300;
>               viewport.scene = myScene;
>               addChild(viewport);
> 
> do i have to call the render function sowhere in the while loop?
> 
> BR
> Dimi
> 
> 
> -- 
> Subscription settings: 
> http://groups.google.com/group/away3d-dev/subscribe?hl=en

Reply via email to