Discuz!NT
欢迎 游客 , 注册 | 登录 | 会员 | 界面 | 简洁版本 | 在线 | 帮助
商都网教育宝典宝库

发表新主题 回复该主题
本主题被查看2151次, 共1个帖子, 1页, 当前为第1页     选择页数: 1      跳转到第   上一主题   下一主题
标题: 编写Flash AS代码实现按钮触发全屏动画
-[尕硴]
超级版主
UID: 71
来自:
精华: 130
积分: 14003
帖子: 12909
注册: 2007-10-22 17:59:00
状态: 离线
威望: 444.00
金钱: 3355.00 元
只看楼主 2007-11-09 15:35
编写Flash AS代码实现按钮触发全屏动画
Flash播放器升级到Flash Player 9,0,28,0后可以使网页中的Flash通过一个简单的按钮实现全屏显示,这和一些视频网站中的效果基本相同,下面我们看看具体怎么实现,不需使用Javascript脚本。   需要我们在网页中插入Flash代码时,必须加上下面的代码:
<param name="allowFullScreen" value="true" />   
下面我们介绍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";
//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插入到网页中时,具体代码如下:
<object data="你的swf文件地址"
type="application/x-shockwave-flash"
width="400" height="200" >
<param name="movie"
value="你的swf文件地址"
/>
<
param name="
allowFullScreen"
value="
true"
/>
</object>  
这样就可以看到前面的全屏和收缩效果了!



huahua 最后编辑于 2007-11-12 14:52:06
#1  
发表新主题 回复该主题
本主题被查看2151次, 共1个帖子, 1页, 当前为第1页     选择页数: 1      跳转到第







现在的时间是 2008-07-05 05:42:04

版权所有 商都网教育宝典
         Powered by Discuz!NT 1.0.6666    Copyright © 2001-2008 Comsenz Inc.
Processed in 0.096 seconds