InteractiveScene3DEvent don't work

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

InteractiveScene3DEvent don't work

ash2010
This post has NOT been accepted by the mailing list yet.
package
{
  import flash.display.Sprite;
  import flash.events.Event;
  import flash.events.MouseEvent;

  import org.papervision3d.cameras.Camera3D;
  import org.papervision3d.events.FileLoadEvent;
  import org.papervision3d.events.InteractiveScene3DEvent;
  import org.papervision3d.objects.DisplayObject3D;
  import org.papervision3d.objects.parsers.DAE;
  import org.papervision3d.render.BasicRenderEngine;
  import org.papervision3d.scenes.Scene3D;
  import org.papervision3d.view.Viewport3D;
  import org.papervision3d.materials.*;
  import org.papervision3d.materials.utils.MaterialsList;
  import org.papervision3d.objects.parsers.Collada;
  import org.papervision3d.view.layer.ViewportLayer;
  import org.papervision3d.core.proto.MaterialObject3D;
  import flash.display.DisplayObjectContainer;
  import org.papervision3d.core.proto.DisplayObjectContainer3D;
 
   public class project extends Sprite
  {
    private var scene     :Scene3D;
    private var camera    :Camera3D;
    private var viewport  :Viewport3D;
    private var renderer  :BasicRenderEngine;
    private var sun :DisplayObject3D;
    private var mat        :BitmapFileMaterial;
    private var mp :MaterialsList;
       
       
  public function project()
   {
          init3D();
          addEventListener(Event.ENTER_FRAME, handleEnterFrame);
          }
                private function init3D():void {
                       
                viewport = new Viewport3D()
                viewport.autoScaleToStage = false;
             viewport.interactive = true;
                viewport.buttonMode=true;
             addChild(viewport);
               
                scene = new Scene3D();
             camera = new Camera3D();
             renderer = new BasicRenderEngine();
               
                var mat:BitmapFileMaterial = new BitmapFileMaterial("3.jpg");
                var mp:MaterialsList = new MaterialsList();
                mp.addMaterial (mat,"lambert1");
                mat.smooth=true;
                mat.interactive=true;
               
               
                sun = new (DAE);
                sun.addEventListener(FileLoadEvent.LOAD_COMPLETE, handleColladaComplete);
                DAE(sun).load("sun.dae",mp);
                sun.scale=25;
                sun.x=-100;
                sun.y=100;

          }
         private function handleColladaComplete(event:FileLoadEvent):void {
                scene.addChild(sun);
                sun.getChildByName("pSphereShape1", true).addEventListener(InteractiveScene3DEvent.OBJECT_CLICK, click2);
         }
         
         private function click2(e:InteractiveScene3DEvent):void{
                 trace("hello");
                }

         private function handleEnterFrame(e:Event):void
     {
      renderer.renderScene(scene, camera, viewport);
      }

  }
}

What's wrong ؟؟

File :
http://www.4shared.com/rar/9z-mANa5/sun.html