Listening for a child being added to a ObjectContainer3D

Software: Away3D 4.x

Avatar
FlyOn, Jr. Member
Posted: 08 December 2011 11:18 AM   Total Posts: 36

How do I make a ObjectContainer3D listen for a child being added to itself?

Object3DEvent.SCENE_CHANGED 
Object3DEvent
.SCENETRANSFORM_CHANGED 

These seem not to be the right ones ...

 

   

Avatar
FlyOn, Jr. Member
Posted: 08 December 2011 11:22 AM   Total Posts: 36   [ # 1 ]

ps I used to do something like this with

Object3DEvent.DIMENSIONS_CHANGED 

... but since that is gone… does anyone know?

   

R Villani, Newbie
Posted: 03 February 2012 03:17 AM   Total Posts: 13   [ # 2 ]

Listen for the Scene3DEvent.ADDED_TO_SCENE from your scene.
Then, on the listener function, you can access the added object from event.currentTarget and check if its parent is your container.
You must check bacause since this event is launched any time some object is added to scene, you cand end up doing stuff to the wrong object.

scene.addEventListener(Scene3DEvent.ADDED_TO_SCENEonAdded);

private function 
onAdded(event:Scene3DEvent):void
{
    
var obj:ObjectContainer3D event.currentTarget;
    if (
obj.parent == this)
    
{
        
// doStuff
    
}
   
   
‹‹ obj mtl embed Error

X

Away3D Forum

Member Login

Username

Password

Remember_me



X