灵活的全屏模式?

时间:2010-02-02 15:22:53

标签: 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

我该怎么做?

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

要使用全屏模式,您必须使用一些javascript。

Adam Kiss'FlexExamples full-screen example向您展示如何使用Flex的旧版默认javascript文件。我建议使用fullscreen and SWFObject

你基本上必须使用javascript将嵌入html的swf对象的属性设置为true:

allowFullScreen: true;

就是这样!