In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

flash on 2009-8-20

Get Adobe Flash player
by williamfang 20 Aug 2009
    Embed
    package {
  import caurina.transitions.Tweener;
   import flash.events.Event;
   import org.papervision3d.materials.ColorMaterial;
   import org.papervision3d.objects.DisplayObject3D;
   import org.papervision3d.objects.primitives.Plane;
   import org.papervision3d.core.effects.view.ReflectionView;
   import org.papervision3d.events.InteractiveScene3DEvent;
   public class PV3D extends ReflectionView
   {
   private var flag:Boolean;
   private var plane:DisplayObject3D;
   private var Material:ColorMaterial=new ColorMaterial(0xff0000);
   public function PV3D()
   {
     super(550,400,false,false);
     init();
     surfaceHeight = -120;//向下120,这个参数始终是以舞台正中间的为起点
     this.addEventListener(Event.ENTER_FRAME,enterFrame);
   }
   private function init():void{
     Material.interactive=true;//设置材质交互为true
     
     Material.doubleSided=true;//默认是单面的。
     plane =new Plane(Material,285,400,4,4)
     plane.y=150;//如果不稍微抬高一点的话,可能会让其倒影超出舞台,或者向下120是不够滴
     scene.addChild(plane);
     viewport.interactive=true;
     viewport.buttonMode=true;//出现手型
     plane.addEventListener(InteractiveScene3DEvent.OBJECT_PRESS, pressHander);
     scene.addChild(plane);
   }
   private function pressHander(e:InteractiveScene3DEvent):void
   {
     Tweener.removeAllTweens();
     flag=!flag;
     if(flag)
     {
      Tweener.addTween(plane,{rotationY:360,scaleX:2,scaleY:2,time:3})
     }else{
      Tweener.addTween(plane,{rotationY:0,scaleX:1,scaleY:1,time:3})
     } 
   }
   private function enterFrame(e:Event):void{
     singleRender();//渲染器
   }
   }
   }