
- 本栏最新文章
- Flash简单实现网页中的Flash动画全屏 04-01
- flash与后台的交互 04-01
- flash缓入缓出运动 04-01
- Flash AS制作上升的水泡效果动画 03-31
- AS柔化函数(解决马赛克) 03-31
- flash+webservice 乱码问题解决一例 03-31
- flash动态改变注册点解决方案 03-31
- Flash 制作晃动的烛光 03-27
- AS2:动态改变注册点(英文) 03-27
- 注册点与中心点 03-27

- 本栏推荐文章
- Photoshop教程:水灵灵的美女调出来 12-30
- AS3与后台交互 12-21
- AS3通俗教程---AS3自身loading制作 12-19
Flash简单实现网页中的Flash动画全屏
Flash播放器自从升级到Flash Player 9,0,28,0,也可以使网页中的Flash通过一个简单的按钮实现全屏显示,和一些视频网站中的效果基本相同,但是在这个教程里是没有使用Javascript脚本的啊!
需要我们在网页中插入Flash代码时,必须加上下面的代码:
Code:
<param name="allowFullScreen" value="true" />
首先看一下效果和源文件:
点此下载源文件
启动Flash,制作一个按钮元件,然后把按钮放到主场景中,为按钮添加代码:
Code:
on(press){
toggleFullScreen();
}
函数toggleFullScreen()是主要来控制窗口,函数定义如下。
Code:
//Don't scale the movie when the stage size changes
Stage.scaleMode="noScale";
//Align the stage to the top left
Stage.align = "TL";
//Function to toggle between fullscreen and normal size
//the toggle fullscreen button calls this function when pressed
function toggleFullScreen(){
//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
resizeListener.onResize = function () {
//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插入到网页中时,具体代码如下,然后把FLASH地址改动即可:
Code:
<object data="做好的FLASH地址"
type="application/x-shockwave-flash" width="400" height="200" >
<param name="movie" value="做好的FLASH地址" />
<param name="allowFullScreen" value="true" />
</object>


