package { import flash.display.*; import flash.events.*; import org.papervision3d.view.*; import org.papervision3d.materials.*; import org.papervision3d.objects.primitives.* import org.papervision3d.cameras.* [SWF(width = "720", height = "300", frameRate = "60", backgroundColor = "#FFFFFF")] public class Main extends BasicView { // 3d vars private var cylinder:Cylinder; /** * Constructor */ public function Main() { super(720, 480, true, false, CameraType.FREE); // init swf stage.scaleMode = StageScaleMode.NO_SCALE; stage.quality = StageQuality.LOW; init3D(); } public function init3D():void { // Attributes var objRaduas :Number = 2797/2 / Math.PI / 2; var objHeight :int = 500/2; var quality :int = 32; var material:BitmapFileMaterial = new BitmapFileMaterial("360.jpg", false); material.doubleSided = true; material.smooth = true; cylinder = new Cylinder(material, objRaduas, objHeight, quality, quality, -1, false, false); scene.addChild(cylinder); camera.x = camera.y = camera.z = 0; camera.focus = 350; camera.zoom = 1; addEventListener(Event.ENTER_FRAME, enterFrameHandler); startRendering(); } private function enterFrameHandler(event:Event):void { // Pan var pan:Number = camera.rotationY - 210 * mouseX/(stage.stageWidth/2); pan = Math.max( -100, Math.min( pan, 100 ) ); // Max speed camera.rotationY -= pan / 12; } } }