2016-10-13 00:16:48 点击量:14 标签: 收藏本文
第一步:注释掉flex项目中的词句 //[SWF(width="1250",height="650",backgroundColor="0X00AAFF")]
As代码如下:调用AddEvent接口
- package helper.fullScreen
- {
- import com.pblabs.engine.PBE;
- import com.pblabs.rendering2D.ui.SceneView;
- import config.ConfigMcWH;
- import config.ConfigSceneMap;
- import config.ConfigVar;
- import controller.publicCreateScene.CC_CreateScene;
- import controller.publicHeroMove.CC_HeroMove;
- import flash.display.Sprite;
- import flash.display.StageAlign;
- import flash.display.StageDisplayState;
- import flash.display.StageScaleMode;
- import flash.events.Event;
- import flash.events.TimerEvent;
- import flash.external.ExternalInterface;
- import flash.system.Capabilities;
- import flash.utils.Timer;
- public class CH_FullScreen
- {
- public function CH_FullScreen()
- {
- }
- private static var instanceVal:CH_FullScreen;
- public static function instance():CH_FullScreen
- {
- if(instanceVal==null)
- {
- instanceVal = new CH_FullScreen();
- }
- return instanceVal;
- }
- private var _sv:SceneView;
- private var _fun:Function;
- public function addAutoEvent(fun:Function=null):void
- {
- if(ConfigVar.screenIsAutoChange==true)
- {
- _fun = fun;
- PBE.mainStage.scaleMode=StageScaleMode.NO_SCALE;
- PBE.mainStage.align=StageAlign.TOP_LEFT;
- PBE.mainStage.addEventListener(Event.RESIZE, resizeDisplay2222);
- }
- }
- /**开启和关闭全屏的接口*/
- private var nowIsFullScreen:Boolean = false;
- public function fullScreen():void
- {
- if(nowIsFullScreen==false)
- {
- PBE.mainStage.displayState = StageDisplayState.FULL_SCREEN;
- nowIsFullScreen = true;
- }else{
- PBE.mainStage.displayState = StageDisplayState.NORMAL;
- nowIsFullScreen = false;
- }
- resizeDisplay2222();
- }
- private function resizeDisplay2222(event:Event=null):void
- {
- if(event!=null)
- {
- trace(event.target.stageWidth+" ... "+event.currentTarget.stageWidth);
- }
- ConfigSceneMap.nowScreenSeeW = PBE.mainStage.stageWidth;
- ConfigSceneMap.nowScreenSeeH = PBE.mainStage.stageHeight;
- var logStr:String = "尺寸发生了变化----------------\n";
- if(event!=null)
- {
- logStr += "event.target : "+event.target.stageWidth+","+event.currentTarget.stageHeight;
- }
- logStr += " PBE.mainStage : "+PBE.mainStage.stageWidth+","+PBE.mainStage.stageHeight;
- logStr += " \nscreenSeeW : "+ConfigSceneMap.screenSeeW+","+ConfigSceneMap.screenSeeH;
- logStr += " nowScreenSeeH : "+ConfigSceneMap.nowScreenSeeW+","+ConfigSceneMap.nowScreenSeeH;
- ConfigVar.logArr.push(logStr);
- /*
- ConfigSceneMap.nowScreenSeeW = (ConfigSceneMap.nowScreenSeeW <= 950) ? 950 : ConfigSceneMap.nowScreenSeeW;
- ConfigSceneMap.nowScreenSeeH = (ConfigSceneMap.nowScreenSeeH <= 560) ? 560 : ConfigSceneMap.nowScreenSeeH;
- ConfigSceneMap.nowScreenSeeW = (ConfigSceneMap.nowScreenSeeW >= 1250) ? 1250 : ConfigSceneMap.nowScreenSeeW;
- ConfigSceneMap.nowScreenSeeH = (ConfigSceneMap.nowScreenSeeH >= 650) ? 650 : ConfigSceneMap.nowScreenSeeH;
- */
- changeFloatSp();
- }
- //改变所有浮动元素的位置
- private function changeFloatSp():void
- {
- ConfigVar.PUBLICMENUSP.x = ConfigSceneMap.nowScreenSeeW - ConfigMcWH.MENUWH.x;
- ConfigVar.PUBLICMENUSP.y = ConfigSceneMap.nowScreenSeeH - ConfigMcWH.MENUWH.y;
- ConfigVar.MENUTOSP.x = 5;
- ConfigVar.MENUTOSP.y = ConfigSceneMap.nowScreenSeeH - ConfigMcWH.CHATWH.y;
- /*
- if(ConfigVar.DIVSP.width>0 && ConfigVar.DIVSP.height>0)
- {
- trace(ConfigSceneMap.nowScreenSeeW+" aaaaaaaaa "+ConfigVar.DIVSP.width +","+ConfigVar.DIVSP.width);
- var folotDivSpW:int = ConfigVar.DIVSP.width;
- var folotDivSpH:int = ConfigVar.DIVSP.height;
- ConfigVar.DIVSP.x = (ConfigSceneMap.nowScreenSeeW - folotDivSpW)/2;
- ConfigVar.DIVSP.y = (ConfigSceneMap.nowScreenSeeH - folotDivSpH)/2;
- trace(ConfigVar.DIVSP.x+","+ConfigVar.DIVSP.y);
- }
- */
- for(var i1:int=0,cnt1:int=ConfigVar.DIVSP.numChildren; i1<cnt1; i1++)
- {
- var obj1:* = ConfigVar.DIVSP.getChildAt(i1);
- if(obj1.visible==true)
- {
- trace(ConfigSceneMap.nowScreenSeeW+" aaaaaaaaa "+obj1.width +" "+obj1.name);
- obj1.x = (ConfigSceneMap.nowScreenSeeW - obj1.width)/2;
- obj1.y = (ConfigSceneMap.nowScreenSeeH - obj1.height)/2;
- }
- }
- }
- }
- }
我们是一家提供综合软件外包与弱电工程服务的技术公司。
业务涵盖定制软件、管理系统、网站、小程序、APP、系统集成、网络布线、监控安防、门禁、机房建设及长期技术维护。
公司地址:湖北省宜昌市伍家岗区东站二路6号三峡(宜昌)大数据产业园海洋馆二楼A203室