发布网友 发布时间:2022-04-20 13:08
共3个回答
热心网友 时间:2023-06-24 09:48
fscommand(fullscreen, true)
复制到按钮代码里面就OK了
热心网友 时间:2023-06-24 09:48
网页中的Flash通过一个简单的按钮实现全屏显示,这和一些视频网站中的效果基本相同,不需使用Javascript脚本。
需要在网页中插入Flash代码时,必须加上下面的代码:
下面介绍Flash中的做法。
启动Flash,制作一个按钮元件,然后把按钮放到主场景中,为按钮添加代码:
on(press){
toggleFullScreen;
}
函数toggleFullScreen是主要来控制窗口,函数定义如下。
//Don't scale the movIE when the stage size changes
Stage.scaleMode="noScale";
//Align the stage to the top left
Stage.align = "TL";
//if normal size, go to fullscreen, else go to normal size
if(Stage["displayState"]=="normal"){
Stage["displayState"]="fullScreen";
}else{
Stage["displayState"]="normal";
}
}
//Create a listener for each time the Stage is resized
var resizeListener:Object = new Object;
//Called each time the stage is resized
//Move the button to the center of the screen
toggleFullScreenButton._x=Stage.width/2;
toggleFullScreenButton._y=Stage.height/2;
}
//Add the listener to Stage
Stage.addListener(resizeListener);
这样就定义好了!
把上面制作的Flash插入到网页中时,具体代码如下:
br /> type="application/x-shockwave-flash" width="400" height="200" >
这样就可以看到全屏和收缩效果了!
热心网友 时间:2023-06-24 09:49
function fullScreen(evt:ContextMenuEvent):void {
if (item.caption == "全屏") {
fscommand("fullscreen","true");
item.caption = "退出全屏";
} else {
fscommand("fullscreen","false");
item.caption = "全屏";
}
}