ObjectContainer3D doesn’t dispatch enter_frame, added, removed…

Software: Away3D 4.x

Aymeric, Newbie
Posted: 10 September 2012 08:01 AM   Total Posts: 9

Hey there, I’m adding away3D as 3d view into my game engine rules by 2D physics (box2d & Nape).

I’ve created a wrapper for the box2d debug view :

package com.citrusengine.view.away3dview {

 import com
.citrusengine.core.State;
 
import away3d.Away3D;
 
import away3d.containers.ObjectContainer3D;
 
 
import Box2DAS.Dynamics.b2DebugDraw;

 
import com.citrusengine.core.CitrusEngine;
 
import com.citrusengine.physics.Box2D;
 
import com.citrusengine.view.away3dview.Away3DArt;

 
import flash.events.Event;

 
/**
  * @author Aymeric
  */
 
public class Box2DDebugArt extends ObjectContainer3D {

  
private var _box2D:Box2D;
  private var 
_debugDrawer:b2DebugDraw;
  
  public function 
Box2DDebugArt() {
   
   addEventListener
(Event.ADDEDhandleAddedToParent);
   
addEventListener(Event.ENTER_FRAMEhandleEnterFrame);
   
addEventListener(Event.REMOVEDdestroy);
   
trace('created');
  
}
  
  
private function handleAddedToParent(evt:Event):void  {
   trace
('added');
   
removeEventListener(Event.ADDEDhandleAddedToParent);
   
   if (
parent is Away3DArt)
    
_box2D Away3DArt(parent).citrusObject as Box2D;
   else
    
_box2D CitrusEngine.getInstance().state.getFirstObjectByType(Box2D) as Box2D;
   
   
_debugDrawer = new b2DebugDraw();
   (
CitrusEngine.getInstance().state as State).addChild(_debugDrawer);
   
_debugDrawer.world _box2D.world;
   
_debugDrawer.scale _box2D.scale;
  
}
  
  
private function destroy(e:Event):void
  {
   removeEventListener
(Event.ADDEDhandleAddedToParent);
   
removeEventListener(Event.ENTER_FRAMEhandleEnterFrame);
   
removeEventListener(Event.REMOVEDdestroy);
  
}
  
  
private function handleEnterFrame(evt:Event):void
  {trace
('ef');
   
_debugDrawer.Draw();
  
}
 }

However the different listeners are never called! This is strange for a container class. I found the issue reported there. If it can’t be added,what is the workaround ?
Thanks for the help!

   

DannyCortes, Newbie
Posted: 14 February 2013 04:27 AM   Total Posts: 1   [ # 1 ]

I have the same problem :(

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X