2010-02-02 120 views
0

我是新來flex。我已經制作了一個網頁,下面的代碼:全屏模式下的Flex?

<?xml version="1.0" encoding="utf-8"?> 
<mx:Application height="100%" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientColors="[#5b4ffb, #5594fb]" themeColor="#808080" cornerRadius="3" width="100%"> 
<mx:Script> 
<![CDATA[ 
import mx.controls.Alert; 
import mx.events.CloseEvent; 
private function clickHandler(event:Event):void { 
    if (UserID.text=="") 
    { 
     Alert.show("Please Enter your user name","Message"); 
     return; 
    } 
    if (Pwd.text=="") 
    { 
     Alert.show("Please Enter your Password","Message"); 
     return; 
    } 
     Alert.show("Login Success","Message"); 
     return; 
    } 
    private function fReset(event:Event):void 
    { 
     UserID.text=""; 
     Pwd.text=""; 
    }   
]]> 
</mx:Script> 

<mx:Image x="246.5" y="10" width="781" height="155" scaleContent="false"> 
    <mx:source>file:///C|/Documents and Settings/user/Desktop/Top.gif</mx:source> 
</mx:Image> 
<mx:Label x="531" y="262" text="User Name" color="#FFFFFF" fontSize="12" width="84"/> 
<mx:Label x="531" y="288" text="Pass Word" color="#FFFFFF" fontSize="12" width="84" height="27"/> 
<mx:Label x="531" y="200" text="Login Information" width="297" color="#FFFFFF" fontFamily="Verdana" fontWeight="bold" fontSize="20"/> 
<mx:Button x="590" y="323" label="Login" cornerRadius="7" click="clickHandler(event);"/> 
<mx:TextInput x="623" y="262" width="160" height="20" id="UserID"/> 
<mx:TextInput x="623" y="293" width="160" height="20" id="Pwd"/> 
<mx:Button x="688" y="323" label="Reset" cornerRadius="7" click="fReset(event);"/> 
</mx:Application> 

當我運行的SWF文件,它的小窗口中運行,但當用戶點擊SWF我希望它在全屏模式下打開,像ctrl + f

我該怎麼做?

回答

0

爲了使用全屏模式,你必須使用一些JavaScript。

Adam Kiss'FlexExamples full-screen example向您展示瞭如何使用Flex的較早的默認JavaScript文件進行操作。我建議使用fullscreen and SWFObject

基本上,你必須設置嵌入到HTML爲true SWF對象的屬性,使用javascript:

allowFullScreen: true;

這就是它!