Hello guys! I´ve got a basic problem with Papervision :_ I´m trying to create and then delete planes from the scene. I was using 1.7 version until I noticed there were not destroy method inside the materials classes so this is my first attemp using Papervision 2.
What I have done to test it is using Papervision2.com Basic Interactive tutorial example. In this, I´m creating 50 planes in the stage and adding them the erase method onMouse Down, here is the code :
// Creating planes…
override protected function init3d():void
{
ourMaterial.interactive = true;
ourMaterial.doubleSided = true;
ourOverMaterial.interactive = true;
ourOverMaterial.doubleSided = true;
for(var i:Number=0; i<50; i++){
planeArray* = new Plane(ourMaterial, 1000,1000, 2, 2);
default_scene.addChild(planeArray*);
planeArray*.addEventListener( InteractiveScene3DEvent.OBJECT_PRESS, _onPress );
planeArray*.x=Math.random()800
planeArray.x=Math.random()600
planeArray.z=Math.random()10
planeArray.rotationX=Math.random()360
planeArray.rotationY=Math.random()360
planeArray.rotationZ=Math.random()*360
}
}
// OnPress Event…
private function _onPress( e:InteractiveScene3DEvent ):void
{
trace(“before destroying plains numChildren is”,default_scene.numChildren);
for(var i:Number=0; i<planeArray.length; i++)
{
ourMaterial.destroy();
planeArray*.removeEventListener( InteractiveScene3DEvent.OBJECT_PRESS, _onPress);
default_scene.removeChild(planeArray*);
planeArray*=null
}
planeArray.splice(0, planeArray.length);
trace(“after destroying planes numChildren is”,default_scene.numChildren);
}
//end
My problem is that I really can´t delete the objects from the Scene, when I request numChildren it display the total amount of planes I placed into the scene. Does anyone know how can I delete objects from the stage? Any Ideas? I´d appreciate any comments.Thx in advance
By the way! I know maybe there would be problem using just one material and destroying it on the itteration, but anyway, I also tried with just one plane and I couldnt delete it :_
Thx
Best Regards
Clau!