=波波日志 > flash/flex/fcs/AIR > Flash简单实现网页中的Flash动画全屏=
[转]Flash简单实现网页中的Flash动画全屏
Flash播放器自从升级到Flash Player 9,0,28,0,也可以使网页中的Flash通过一个简单的按钮实现全屏显示,和一些视频网站中的效果基本相同,但是在这个教程里是没有使用Javascript脚本的啊!
需要我们在网页中插入Flash代码时,必须加上下面的代码:
函数toggleFullScreen()是主要来控制窗口,函数定义如下。
这样就制作好了!
当我们把上面制作的Flash插入到网页中时,具体代码如下:
需要我们在网页中插入Flash代码时,必须加上下面的代码:
+展开
-HTML
<param name="allowFullScreen" value="true" />
实现网页中的Flash动画全屏显示源代码
启动Flash,制作一个按钮元件,然后把按钮放到主场景中,为按钮添加代码:
+展开
-ActionScript
on(press){
toggleFullScreen();
}
toggleFullScreen();
}
函数toggleFullScreen()是主要来控制窗口,函数定义如下。
+展开
-ActionScript
//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);
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插入到网页中时,具体代码如下:
+展开
-HTML
<object data="http://www.webjx.com/upfiles/20071018/20071018224608_fullscreen.swf"
type="application/x-shockwave-flash" width="400" height="200" >
<param name="movie" value="http://www.webjx.com/upfiles/20071018/20071018224608_fullscreen.swf" />
<param name="allowFullScreen" value="true" />
</object>
type="application/x-shockwave-flash" width="400" height="200" >
<param name="movie" value="http://www.webjx.com/upfiles/20071018/20071018224608_fullscreen.swf" />
<param name="allowFullScreen" value="true" />
</object>
就可以看到前面的全屏和收缩效果了!
来源:http://www.webjx.com/htmldata/2007-10-18/1192718877.html
相关文章推荐
JavaScript全屏打开网页
类别:flash/flex/fcs/AIR 作者:转载 日期:2010-05-12 【评论:0】
暂时没有评论!
发表留言
百度赞助
同类热门博文
- ·As+lightbox+js实现..
- ·21.8.使用Cairngorm..
- ·13.1.为ArrayCollec..
- ·18.13.通过二进制So..
- ·22.7.使用ModuleLoa..
- ·JavaScript控制Flas..
- ·6.6.动态载入外部图..
- ·flash预加载进度条p..
博格Tag
- flash/flex/fcs/AIR(752)
- Asp.Net/C#/WCF(598)
- 操作系统及应用软件(376)
- JavaScript/Ajax(330)
- SQL及数据库(134)
- 黑客技术(115)
- Asp/VBScript(111)
- HTML/WML/CSS兼容/XML(102)
- PHP/apache/Perl(96)
- 网站排名及优化(96)
- 其他(75)
- showbo日志(66)
- lucene.net/分词技术(33)
- 计算机网络(26)
- 机械重工(26)
- C#设计模式(25)
- Google Maps开发(17)
- 日语学习(15)
- Canvas/VML/SVG(13)
- linux(11)
- 游戏开发(8)
- 正则表达式(5)
- Jsp/Java(4)
最新博文
- ·PHP socket套接字学..
- ·Warning Cannot sen..
- ·php与flash as3 soc..
- ·Flash XMLSocket使用..
- ·给flash右键增加自定..
- ·flash控件html及col..
- ·Flash加载XML文件CD..
- ·Flex3中文教程--hom..
随机博文
