1、package import fl.controls.ColorPicker;import flash.events.*;import .*;import flash.display.*;import flash.sampler.NewObjectSample;import flash.text.*;import fl.containers.ScrollPane;import org.papervision3d.cameras.CameraType;import org.papervision3d.objects.primitives.Sphere;import org.papervision
2、3d.view.BasicView;import org.papervision3d.materials.BitmapFileMaterial;import sliz.miniui.Button;import caurina.transitions.Tweener;public class mode3 extends BasicViewprivate var sphere:Sphere;private var material:BitmapFileMaterial;private var panoramas_array:Array=new Array();private var room_na
3、me:Array=new Array();private var x_point:Array=new Array();private var y_point:Array=new Array();private var guider:Array=new Array();/舞台长宽private var w:Number=1000;private var h:Number=900;/平面图的长宽,总的平面图的宽度private var panel_width:Number;private var panel_height:Number;/球体在 XY 轴上旋转地角度private var angl
4、eX:Number;private var angleY:Number;/功能按钮状态private var down:Number=0;/拖动球体是按下时鼠标的坐标private var downX:Number;private var downY:Number;/选择的房间号private var room_no:Number;/定义功能按钮/private var up_btn:Sprite=new Button(“button1“);private var up_btn:Sprite=new Button(“向上“);private var down_btn:Sprite=new Bu
5、tton(“向下“);private var left_btn:Sprite=new Button(“向左“);private var right_btn:Sprite=new Button(“向右“);private var zoomIn_btn:Sprite=new Button(“放大“);private var zoomOut_btn:Sprite=new Button(“放小“);private var previous_btn:Sprite=new Button(“向下 “);private var next_btn:Sprite = new Button(“向下“);privat
6、e var showhide_btn:Sprite = new Button(“);/按钮数组private var buttons:Array=new Array();private var points:Array=new Array();/xml 导入器private var xml_loader:URLLoader;private var dataXML:XML;/全景相关信息private var panel_image:String=“;private var panoramas_image:String=“;private var guide_image:String=“;pri
7、vate var room_x:String=“;private var room_y:String=“;private var image_name:String=“;/布局容器private var panel_image_container:ScrollPane=new ScrollPane();private var guide_image_container:ScrollPane=new ScrollPane();/显示房间名字的文本private var room_name_container:TextField;private var panel_room_name:TextFi
8、eld;private var formatter:TextFormat;/panel_image_container 容器中的二级容器,在总图里的的链接private var point_container:Sprite;private var panelImg_loader:Loader;/总的楼房数private var totalhouse:Number;/选择的楼房private var house_number:Number=0;public function mode3()/布置全景显示的位置super(800,390,false, false,CameraType.FREE);
9、/第 1、2 个参数设置主画面的大小。this.x=20;/左上角的起点坐标this.y=20;init();private function init():voidinitObj();/注册帧频侦听用于不断刷新屏幕this.addEventListener(Event.ENTER_FRAME,onEnterFrame);/拖动球体鼠标按下时注册侦听this.addEventListener(MouseEvent.MOUSE_DOWN,onDown);/拖动球体鼠标发开时注册侦听this.addEventListener(MouseEvent.MOUSE_UP,onUp);/设置全屏参数/st
10、age.scaleMode=StageScaleMode.NO_SCALE;stage.align=StageAlign.TOP_LEFT;stage.scaleMode = StageScaleMode.SHOW_ALL;panel_image_container.alpha = 0.02;panel_image_container.addEventListener(MouseEvent.MOUSE_OUT, panelout);panel_image_container.addEventListener(MouseEvent.MOUSE_OVER, panelover);private f
11、unction initObj():void/设置舞台背景var bg:Sprite=new Sprite()/new background2();bg.x=4;bg.y=4;stage.addChildAt(bg,0);panel_image_container.setSize(430,310);panel_image_container.x = 470;panel_image_container.y=20;stage.addChild(panel_image_container);guide_image_container.setSize(600,430);guide_image_cont
12、ainer.x=20;guide_image_container.y=410;stage.addChild(guide_image_container);/设置按钮区的背景var uploda:Loader = new Loader();up_btn.addChild(uploda);uploda.load(new URLRequest(“./image/shang.jpg“);up_btn.addChild(uploda);var download:Loader = new Loader();down_btn.addChild(download);download.load(new URLR
13、equest(“./image/xia.jpg“);var leftload:Loader = new Loader();left_btn.addChild(leftload);leftload.load(new URLRequest(“./image/zuo.jpg“);var rightload:Loader = new Loader();right_btn.addChild(rightload);rightload.load(new URLRequest(“./image/you.jpg“);var zoominload:Loader = new Loader();zoomIn_btn.
14、addChild(zoominload);zoominload.load(new URLRequest(“./image/fangda.jpg“);var zoomoutload:Loader = new Loader();zoomOut_btn.addChild(zoomoutload);zoomoutload.load(new URLRequest(“./image/suoxiao.jpg“);var showhideload:Loader = new Loader();showhide_btn.addChild(showhideload);showhideload.load(new UR
15、LRequest(“./image/showhide.jpg“);buttons.push(up_btn,down_btn,left_btn,right_btn,zoomIn_btn,zoomOut_btn);/排列按钮位置for(var i=0;i0)change_map(0);elsetrace(“xml 中还未添加数据“);catch(e:TypeError)trace(e.message);private function change_map(house_no:Number):voidscene.removeChild(sphere);/清房间点数组for(var i=0;i=Math.sqrt(3)/3else if(down=8)angleX=0;angleY=0;elseangleX=0.5;angleY=0;/ 旋转摄像机camera.rotationX+=angleY;