<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955" minHeight="600"
creationComplete="showIt();"
>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import flash.display.Sprite;
import flash.events.Event;
import org.papervision3d.cameras.Camera3D;
import org.papervision3d.objects.primitives.Sphere;
import org.papervision3d.render.BasicRenderEngine;
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.view.Viewport3D;
private var scene:Scene3D;
private var viewport:Viewport3D;
private var camera:Camera3D;
private var renderEngine:BasicRenderEngine;
private var sphere:Sphere;
private function showIt():void{
//this.stage.frameRate = 40;
scene = new Scene3D();
camera = new Camera3D();
sphere = new Sphere(null, 400,30,30);
scene.addChild(sphere);
viewport = new Viewport3D();
bc.rawChildren.addChild(viewport);
viewport.x=30;
viewport.y=10;
viewport.z=-60;
renderEngine = new BasicRenderEngine();
renderEngine.renderScene(scene,camera,viewport);
addEventListener(Event.ENTER_FRAME, render);
this.callLater(setRate);
}
private function render(e:Event):void
{
sphere.localRotationY +=1;
sphere.localRotationX +=1;
sphere.localRotationZ +=1;
renderEngine.renderScene(scene, camera, viewport);
}
private function setRate():void{
if (this.parentApplication!=null)
{
this.parentApplication.frameRate = 40;
}
}
]]>
</fx:Script>
<mx:Canvas backgroundColor="#945D5D" id="bc" x="205" y="69" width="465" height="340"/>
</s:Application>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955" minHeight="600"
creationComplete="showIt();"
>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import flash.display.Sprite;
import flash.events.Event;
import org.papervision3d.cameras.Camera3D;
import org.papervision3d.objects.primitives.Sphere;
import org.papervision3d.render.BasicRenderEngine;
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.view.Viewport3D;
private var scene:Scene3D;
private var viewport:Viewport3D;
private var camera:Camera3D;
private var renderEngine:BasicRenderEngine;
private var sphere:Sphere;
private function showIt():void{
//this.stage.frameRate = 40;
scene = new Scene3D();
camera = new Camera3D();
sphere = new Sphere(null, 400,30,30);
scene.addChild(sphere);
viewport = new Viewport3D();
bc.rawChildren.addChild(viewport);
viewport.x=30;
viewport.y=10;
viewport.z=-60;
renderEngine = new BasicRenderEngine();
renderEngine.renderScene(scene,camera,viewport);
addEventListener(Event.ENTER_FRAME, render);
this.callLater(setRate);
}
private function render(e:Event):void
{
sphere.localRotationY +=1;
sphere.localRotationX +=1;
sphere.localRotationZ +=1;
renderEngine.renderScene(scene, camera, viewport);
}
private function setRate():void{
if (this.parentApplication!=null)
{
this.parentApplication.frameRate = 40;
}
}
]]>
</fx:Script>
<mx:Canvas backgroundColor="#945D5D" id="bc" x="205" y="69" width="465" height="340"/>
</s:Application>