« Return to Thread: Collada InteractiveScene3DEvent

Re: Collada InteractiveScene3DEvent

by AngelicD :: Rate this Message:

Reply to Author | View in Thread

Don't know if this will help you bu this is what I did for my case... Basically i have my own addEventListener function in my "shape" object that checks to see if the collada has been loaded yet or not, if it has it will attach the listeners if not it will add an event for when it has loaded to attach the listeners. So basically i'm doing what was suggest earlier to loop through all the objects in the collada and attach the listeners.

public function addEventListener(type:String, listener:Function):void
                {
                        if(_geometryLoaded)
                        {
                                for each( var child : DisplayObject3D in _geometry.children )
                                {
                                        addEventListenerToChildren(child, type, listener);
                                }
                        }
                        else
                        {
                                _geometry.addEventListener(FileLoadEvent.LOAD_COMPLETE, attachEvents);
                        }
                }
               
                public function attachEvents(event:flash.events.Event):void
                {
                        _geometryLoaded = true;
                       
                        var event1:vizible.viewer.Event = null;
                       
                        for(var i:int = 0; i < cell._events.length; i++)
                        {
                                event1 = cell._events.getItemByIndex(i) as vizible.viewer.Event;
                                addEventListener(event1.type, event1.listener);
                        }
                }
               
                public function addEventListenerToChildren(child:DisplayObject3D, type:String, listener:Function):void
                {
                        child.addEventListener(type, listener);
                       
                        for each( var child1 : DisplayObject3D in child.children )
                        {
                                addEventListenerToChildren(child1, type, listener);
                        }
                }


I still need to figure out why enabling useOwnContainer = true stops events from working!
Ashley Davison wrote:
I have been wondering about this. I have scenes working well with the getChildByName, but I have the situation now where I won't know the identifier. Been working on some workarounds in order to initiate interactivity on a  collada more generically, but nothing really robust. Anyone got any ideas?
 

 « Return to Thread: Collada InteractiveScene3DEvent