Whoa! Thanks, Aji, that's some awesomeness I didn't know about.

I was able to track down the children I needed. It seems somewhere on
the way of asset embedding, converting to xml and parsing the
originally assigned child names got replaced by auto-generated IDs
(e.g. "ID11" - I'd have never guessed on that one).

For anyone who may be stumbled upon the same problem: the debug gives
this output and the nodes "ID11" and "ID20" are the children I was
looking for.
====================
 ! ------------- Begin Parse Collada -------------
 ! ------------- Begin Parse Scene -------------
 + Parse Node : ID11 : ID11
 + Parse Node : ID20 : ID20
 ! ------------- End Parse Scene -------------
 ! ------------- No animations to parse -------------
 + Parse Geometry : ID12
 + Parse MeshMaterialData
 + Parse Geometry : ID21
 + Parse MeshMaterialData
 + Build Material : ID3
 + Material Type : textureMaterial
 + Build Mesh : ID11
 + Build Mesh : ID20
====================


On Nov 8, 2:04 am, Aji Pamungkas <[email protected]> wrote:
> 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

Reply via email to