Hello sapphiriotic, Try using "away3dlite.core.utils.Debug" (if you are using away3dlite), or "away3d.core.utils.Debug" (if you are using away3d), and set "Debug.active=true". It will trace the name of the children in a collada.
On Sun, Nov 7, 2010 at 8:14 PM, sapphiriotic <[email protected]> wrote: > Has anyone succeeded in accessing children of loaded .DAE file? > In my dae there should be one child("COLLADA_scene") containing two > more children. Previously i wrote the code using PV3D and after > compiling I always had some system traces about dae children so i > could see their names. No probs accessing them either. > Now I switched to Away3D and no matter how i try anything like > _daeContainer.getChildByName("child_name"); (tried both > "COLLADA_scene" and inner children names) - it's always null. Though > if I trace a child of _daeContainer children I get something like "$: > x:0 y:0 z:50" in the output. So there is one child. > > I must be doing something wrong. Any suggestions would be greatly > appreciated. > > Here's a related piece of code: > > public var canvasHolder:MovieClip; > private var _model:IModel; > private var _cam:Camera3D; > private var _view:View3D; > private var _materialMug:MovieMaterial; > private var _daeContainer:ObjectContainer3D; > > public function DaeObjectAway3D(model:IModel) > { > _model = model; > > if (stage) > { > initEngine(); > } > else > { > addEventListener(Event.ADDED_TO_STAGE, > initEngine); > } > } > > private function initEngine(e:Event = null):void > { > removeEventListener(Event.ADDED_TO_STAGE, > initEngine); > > _cam = new Camera3D(); > _cam.moveUp(70); > _cam.moveBackward(400); > _view = new View3D({x:stage.width / 2, > y:stage.height / 2, > camera:_cam}); > addChild(_view); > > addEventListener(Event.ENTER_FRAME, onEnterFrame); > > initObjects(); > } > > private function onEnterFrame(e:Event):void > { > _view.render(); > } > > private function initObjects():void > { > _materialMug = new MovieMaterial(new TextureGFX(), > {autoUpdate:true,precision: > 1,smooth:true,interactive:true,transparent:false}); > canvasHolder = _materialMug.movie["canvasHolder"]; > > _daeContainer = > Collada.parse(_model.resourceManager.daeXML, new > Init({autoLoadTextures: false})); > _daeContainer.scale(.25); > _daeContainer.y = 10; > _daeContainer.x = -7; > _daeContainer.rotationY = 180; > _view.scene.addChild(_daeContainer); > > for each (var child : Mesh in > _daeContainer.children) > { > if(child is Mesh) child.material = > _materialMug; > } > > > ///// CONFIGURE EVENT LISTENERS > > _daeContainer.addEventListener(MouseEvent3D.MOUSE_OVER, > interactiveEventHandler); > > _daeContainer.addEventListener(MouseEvent3D.MOUSE_OUT, > interactiveEventHandler); > > _daeContainer.addEventListener(MouseEvent3D.MOUSE_MOVE, > interactiveEventHandler); > > _daeContainer.addEventListener(MouseEvent3D.MOUSE_DOWN, > interactiveEventHandler); > > _daeContainer.addEventListener(MouseEvent3D.MOUSE_UP, > interactiveEventHandler); > > dispatchEvent(new Event(Model.EVENT_DAE_LOADED)); > } > -- Aji Pamungkas
