`
fuerbosi
  • 浏览: 464055 次
文章分类
社区版块
存档分类
最新评论

Flex4/Air之隐藏状态栏,标题栏,最大,最小,半闭按钮,窗体可拖拽效果

 
阅读更多

在进行前台显示的过程中,也即桌面应用程序开发过程中,我个有时候会用到一些效果,比如只要一个浮动的无状态栏,标题栏,最大,最小,半闭按钮,并且窗体还可以拖动的效果,为了实现这个效果,我们就要对其进行一系列处理,

1.首先在在家***-app.xml文件中,大概54左右加入,即在<initialWindow>标签内加入如下代码:

 <!-- The type of system chrome to use (either "standard" or "none"). Optional. Default standard. -->
  <systemChrome>none</systemChrome>
  <!-- Whether the window is transparent. Only applicable when systemChrome is none. Optional. Default false. -->
  <transparent>true</transparent>
		

上面的代码用来隐藏标题栏,最大,最小,半闭按钮,


2.接下来在<s:WindowApplication>中加入

<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
					   xmlns:s="library://ns.adobe.com/flex/spark" 
					   xmlns:mx="library://ns.adobe.com/flex/mx"
					   width="1558"
					   height="740"
					   showStatusBar="false"
			。。。。。。。。。。。。。。。。。。。。。。。
					   >

3.实现置顶和拖动效果,关键代码如下所示:

		this.stage.nativeWindow.startMove();
	        this.stage.nativeWindow.alwaysInFront=true;


4.在这里,我用了一个定时器做特效效果,主要代码如下:

		public var glowTimer:Timer=new Timer(5000);
			
			
			protected function application1_initializeHandler(event:FlexEvent):void
			{
				// TODO Auto-generated method stub
				glowTimer.addEventListener(TimerEvent.TIMER,GlowTimerFunc);
				glowTimer.start();
				
				
			}
			
			public function GlowTimerFunc(event:TimerEvent):void{
				Glow1.target=welcomeLeader;
				Glow1.play();
			}

5.这里附上所示代码,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
					   xmlns:s="library://ns.adobe.com/flex/spark" 
					   xmlns:mx="library://ns.adobe.com/flex/mx"
					   width="1558"
					   height="740"
					   backgroundColor="#00244f"
					   showStatusBar="false"
					   backgroundAlpha="0"
					  creationComplete="windowedapplication1_creationCompleteHandler(event);"
				      initialize="application1_initializeHandler(event);"
					   >
	<fx:Declarations>
		<!-- 将非可视元素(例如服务、值对象)放在此处 -->
		<mx:Glow id="Glow1"  alphaFrom="0" alphaTo="1" blurXFrom="1"
				 blurXTo="100" blurYFrom="1" blurYTo="100" duration="5000" 
				 color="#00244f"  inner="true" target="{welcomeLeader}"/>
	</fx:Declarations>
	
	
	<fx:Script>
		<![CDATA[
			import mx.events.FlexEvent;
			import flash.display.NativeWindow;
			
			public var glowTimer:Timer=new Timer(5000);
			
			
			protected function application1_initializeHandler(event:FlexEvent):void
			{
				// TODO Auto-generated method stub
				glowTimer.addEventListener(TimerEvent.TIMER,GlowTimerFunc);
				glowTimer.start();
				
				
			}
			
			public function GlowTimerFunc(event:TimerEvent):void{
				Glow1.target=welcomeLeader;
				Glow1.play();
			}
			
			protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
			{
				
			//	this.nativeWindow.startMove();
				
			//	this.stage.nativeWindow.alwaysInFront=false;
				/**stage.nativeWindow
				var window:NativeWindow = stage.nativeWindow;
				window.alwaysInFront = true; //alwaysInFront 如果为 true,那么就表示这个AIR窗体始终置前!
				**/
//				window.alwaysInFront = true;
		
				// TODO Auto-generated method stub
				//http://hi.baidu.com/taotao5453/blog/item/29d97c8dcc768708b31bba93.html
				//stage.window.alwaysInFront=!stage.window.alwaysInFront; 
				//stage.window.startMove(); 
				
	
				
			}
			
			
			import mx.graphics.ImageSnapshot; 
			import mx.controls.Image; 
			import mx.core.UIComponent; 
			
			public var uiComponent:Object; 
			public var targetImage:Image; 
			public var Ax:int = 0; 
			public var Ay:int = 0; 
			public function mouseDown(event:MouseEvent):void{ 
		
				this.stage.nativeWindow.startMove();
				this.stage.nativeWindow.alwaysInFront=true;
			} 

			
			
		]]>
	</fx:Script>
	
	<!--  欢迎词可配置, 添    -->
	<s:Label id="welcomeLeader" x="4" y="9" width="1554" height="160" alpha="0.9"
			 backgroundColor="#00244f" color="yellow" fontFamily="中易黑体" fontSize="45"
			 fontWeight="bold" text="   热烈欢迎*****************************一行莅临*********指导工作" textAlign="left"
			 verticalAlign="middle"
			 mouseDown="mouseDown(event)" 
			 
			 />
</s:WindowedApplication>


特效如下所示:



(完,待续)


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics