Mouse over faces of PV3D cube
Problem
When you try to interact with cube material to determine which face has mouse over it, it is impossible to do it with adding OBJECT_OVER listener to cube.
Solution
Basic thing is that instead of putting listener for mouse over, we listen to mouse move. Or if we put it in perspective of listeners in cube with which we are working, OBJECT_OVER listener is replaced with OBJECT_MOVE listener.
You will need one variable for holding current cube face on which mouse is over:
private var currentCubeFace:String = "";
Next, you'll need to add listener to your cube:
this.cube.addEventListener( InteractiveScene3DEvent.OBJECT_MOVE, cubeMoveHandler );
Finally in cubeMoveHandler you will need to check if face on which mouse is over has changed. That is neccessary so that event only occur once. That way we simulate OBJECT_OVER method but which works will cube faces. Here is cubeMoveHandler method:
private function cubeMoveHandler( event:InteractiveScene3DEvent ):void { //Check if mouse is over another cube face if ( this.currentCubeFace != ( event.target.name + "" + event.face3d.material.name ) ) { this.currentCubeFace = event.target.name + "" + event.face3d.material.name; this.textField.text = "Target: " + event.target.name + ", face: " + event.face3d.material.name; } }