ObjectContainer3D doesn’t fire Events

Software: Away3D 4.x

andreahmed, Member
Posted: 07 October 2013 09:53 AM   Total Posts: 62

Hi All,

I’m trying to fire the Event.ENTER_FRAME, on a 3DS Loader, which is objectcontainter3d, but it doesn’t fire the event at all.

Is there a workaround for that problem?

   

Avatar
GoroMatsumoto, Sr. Member
Posted: 08 October 2013 07:47 AM   Total Posts: 166   [ # 1 ]

I ran into same.
This is just a workaround.

I had to addChild a displayObject to the stage.
That’s a mediator between the display list and ObjectContainer3D.

In your 3d object class:

public var eventor:Sprite = new Sprite(); 

In your main class:

this.addChild(3dObj.eventor); 

And fire the event from the item.

In your 3d object class:

eventor.dispatchEvent(new Event(Event.ENTER_FRAME)); 
   

andreahmed, Member
Posted: 08 October 2013 07:50 AM   Total Posts: 62   [ # 2 ]

Thanks so much.

Is it ok to extend EventDispatcher?

   

Avatar
GoroMatsumoto, Sr. Member
Posted: 08 October 2013 07:58 AM   Total Posts: 166   [ # 3 ]

Try it.

   

andreahmed, Member
Posted: 08 October 2013 08:09 AM   Total Posts: 62   [ # 4 ]

An off topic question. My 3D Object, has the X,Y reversed ( local co-ordinates).
How do I swap them ?
I tried to translate it to 0,0,0, then rotate it 90 degree, but object’s rotation is still in correct.

   

Avatar
SharpEdge, Member
Posted: 08 October 2013 08:24 AM   Total Posts: 94   [ # 5 ]

You should extend EventDispatcher when you want to “dispatch” events, in this case you want to “listen” to events, and in particular you want to listent to a specific type of event: ENTER_FRAME.

ENTER_FRAME is dispatched only by DisplayObject and all Classes that extend it, and this is not sufficent because the object should be added to the Stage!

So the solution is the one proposed by Matsumoto or using a sort of controller class, similar to HoverController,  that it’s not a concrete and real entity but an abstract concept and is handled by the SceneManager.
Now you can pass to this controller your View3D that will dispatch your ENTER_FRAME event or create an update() method like all the controllers of Away3D and call it from the SceneManager.
You should pass to it the wheels too and it will handle all the magical logic of them.

If you want code logic inside the wheels you should put only the logic that controls the aspects of the wheel individually and that should not interact with the exterior.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X