Forked from: tkinjo's forked from: Hello PV3D diff:28 PV3D Event ... @author tkinjo tkinjo forked:0favorite:1lines:30license : MIT License modified : 2009-03-20 23:07:43 Embed Tweet // forked from tkinjo's forked from: Hello PV3D package { import flash.text.TextField; import org.papervision3d.events.InteractiveScene3DEvent; import org.papervision3d.materials.ColorMaterial; import org.papervision3d.objects.primitives.Plane; import org.papervision3d.view.BasicView; [SWF(width = "465", height = "465", frameRate = "60", backgroundColor = "#000000")] /** * ... * @author tkinjo */ public class Main extends BasicView { private var counterTextField:TextField; public function Main() { // カウンタ設定 counterTextField = new TextField(); counterTextField.textColor = 0xffffff; counterTextField.text = ( 0 as uint ).toString(); addChild( counterTextField ); /* -------------------------------------------------- * PV3D の設定 * -------------------------------------------------- */ viewport.interactive = true; // ビューポートでイベントを取得できるよう設定 var colorMaterial:ColorMaterial = new ColorMaterial( 0xffffff ); colorMaterial.interactive = true; // 当カラーマテリアルでイベントを取得できるよう設定 var plane:Plane = new Plane( colorMaterial ); scene.addChild( plane ); plane.addEventListener( InteractiveScene3DEvent.OBJECT_PRESS, planePressHandler ); startRendering(); } private function planePressHandler( event:InteractiveScene3DEvent ):void { counterTextField.text = ( ( parseInt( counterTextField.text ) + 1 ) as uint ).toString(); } } } Code Fullscreen Preview Fullscreen Tamanegi_ken.. cast event pv3d InteractiveScene3DEvent.OBJECT_PRESS interactive toString InteractiveScene3DEvent parseInt addEventListener textColor text TextField uint