Actionscript 3 – Papervision3D Interactive Collada, DAE objects.
If you dont know what is a collada object. The Collada files, are 3d models exported to xml format. With Papervision3D we can create the models into our flash. If you need more info you could read the next link
If you need interactive collada, must meet the following requirements:
- Thw viewport must be interactive…. viewport.interactive = true.
- All materials of the DAE object must be interactive also.
- You need to add a listener for the InteractiveScene3DEvent that you want into each child of your collada.
Here a example how to set all materials to interactive :
1 2 3 4 5 6 7 | private function setInteractiveMaterials(targetObject:DisplayObject3D, value:Boolean):void { for each(var mat:MaterialObject3D in _targetObject.materials.materialsByName) { mat.interactive = value; } } |
How to put a eventListener into each child.
1 2 3 4 5 6 7 8 | private function addEventListeners(displayObject:DisplayObject3D, eventType:String, listener:Function):void { displayObject.addEventListener(eventType, listener); for each(var child:DisplayObject3D in displayObject.children) { addEventListeners(child, eventType, listener); } } |
The call of the last function will be this:
1 | addEventListeners(_obj, InteractiveScene3DEvent.OBJECT_PRESS, daePressedHandler); |
I’m not sure if this way is the better. If you have some idea or suggest please post your comments.
VIEW EXAMPLE
DOWNLOAD EXAMPLE FOR CS4
DOWNLOAD EXAMPLE FOR CS3




