buttonMode for a single object in Papervision 3D


/ Published in: ActionScript 3
Save to your folder(s)

There is no buttonMode property in the DisplayObject3D class in Papervision 3D. But there is a buttonMode for the viewport. So this would be my solution to create a hand cursor on a object.


Copy this code and paste it in your HTML
  1. //one solution
  2. your3dObject.addEventListener(InteractiveScene3DEvent.OBJECT_OVER, over3dObject);
  3. your3dObject.addEventListener(InteractiveScene3DEvent.OBJECT_OUT, out3dObject);
  4.  
  5. //active buttonMode
  6. function over3dObject(evt:InteractiveScene3DEvent):void
  7. {
  8. this.viewport.buttonMode = true;
  9. }
  10.  
  11. //disable buttonMode
  12. function out3dObject(evt:InteractiveScene3DEvent):void
  13. {
  14. this.viewport.buttonMode = false;
  15. }
  16.  
  17.  
  18. //solution when you are working with viewport layers
  19. var my3dObjectLayer:ViewportLayer = this.viewport.getChildLayer(my3dObject);
  20. my3dObjectLayer.buttonMode = true;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.