分享

flash在浏览器中全屏显示和加入收藏的代码

 云端的流浪 2010-11-13

第一种方法:
不显示浏览器菜单栏、工具栏的全屏。这种全屏稍稍 复杂,也与FLASH的设置无关,但要借
助JavaScript来完成。方法是:在HTML文件中<head></head>间加入以下代码:
<script language="JavaScript"> 
<!-- 
window.open("nfd.swf","","fullscreen=1,menubar=no,width=100%,height=100%") 
//--> 
</script>
第二种方法:
也可以在SWF文件的第一帧Actions上的GETURL 命令上加上:

也可以在SWF文件的第一帧Actions上的GETURL 命令上加上:
javascript:window.open("nfd.swf","","fullscreen=1,menubar=no,width=800,height=600")
这种全屏也是类似屏 保,用ALT+F4或设置按钮退出。把fullscreen设为=0,则只是不显示浏览器菜
单栏、工具栏的全屏。
还有一个写法:

javascript:window.open("*.swf","","menubar=no,
toolbar=no,location=no,status=no,fullscreen=yes")

javascript:window.open("*.swf","","menubar=no,
toolbar=no,location=no,status=no,fullscreen=yes")


我个人推荐这种^_^


第三种方法:
稍麻烦一些,需要两个网页,呵呵*—*
你可以建立个空白网页加上代码 :

<html> 
<script language="JavaScript">
window.open("*.htm","newwin","fullscreen=yes,status=no,location=no,
toolbar=no,directories=no,menubar=no,resizable=yes,scrollbars=no");
</script>
</html>
*.htm 你把他替换为 你自己要全屏打开的网页就可以了


第四种方法:
这种方法更详细,还有步骤,不过我没有试过,你们可以先试一下啊。
我把 操作步骤写下:
1、在Flashk中做好动画后,首先选择主菜单中的File Publish Settings(文件发布设置命令),弹出对话框,点击进入HTML项设置: 设置Dimensions尺寸单位为Percent百分比;在宽,高中设置100。再点击发布按钮进行发布即可。这样,在你原文件处就会生成一个和动画同名的HTML 文件。
2、建立一个空白的HTML页面blank.htm,只保留<html></html>标签部分。
3、建立一个有带框架的html文件show.html,页面 html文本如下:

<html>
<frameset rows="100%,*" framespacing="0" frameborder="no" border="0">
<frame name="top" src="动画名.html" frameborder="0" border="0" 
marginwidth="0" marginheight="0" leftmargin="0" rightmargin="0" topmargin="0">
<frame name="blank" src="blank.html"
frameborder="0" border="0" marginwidth="0" marginheight ="0" leftmargin="0" rightmargin="0" topmargin="0">
</frameset>
</html>
该文件将页面分为两个框 架,上面放动画名.html文件,下面放blank.html文件。
注:其中,动画名.html文件是在第一步中发布出来的相应的html文件。
4、建立一个带 JavaScript脚本的html文件full.html。用这个文件打开show.html并
定义其显示窗口为全屏,不带菜单,滚动条,状态栏等。
该文件的html文本如 下:

<html>
<script language="JavaScript">
window.open("show.html","newwin","fullscreen=yes,status=no,location=no,toolbar=no,
directories=no,menubar=no,resizable=yes,scrollbars=no");
</script>
</html>
上面的第四步和第三种方法一样的
如何在FLASH中实现加入收藏夹与设为首页的效果
问: 如何用actionscript将页面设为首页和加入收藏夹?
答: 一,用getURL的方法:

设为首页:

on (release) { 
getURL("getURL("javascript:void(document.links[0].style.behavior=’url(#default#homepage)’);void document.links[0].setHomePage(’http:// 您的网站地址/’);", "_self", "POST"); }
加入收藏夹:
on (release) { 
getURL("getURL("javascript:void window.external.AddFavorite(’http://您的网站地 址’,’网站名称’);", "_self", "POST");}
第二种方法是通过用fscommand的方法,比上面一个要复杂一些。首先在Flash 的按钮上添加ActionScript脚本代码
设为首页

on (release) { fscommand("setHomePage", "http://您的网站地址"); }
加入收藏夹

on (release) { fscommand("addFavorite", "http://网站地址|网站名称"); }
在发布 Flash动画时选上HTML,在Template下拉菜单中选择Flash with fscommand,发布出html页面接着要对发布出来的HTML页面进行修改,在HTML代码中找 到这么一段

// Handle all the the FSCommand messages in a Flash movie&nb sp;function sethomepage_DoFSCommand(command, args) { } 
这一段修改成 // Handle all the the FSCommand messages in a 
Flash movie function sethomepage_DoFSCommand(command, args) { 
var sethomepageObj = InternetExplorer ? sethomepage : document.sethomepage; if ( command == "setHomePage") {
document.links[0].style.behavior = "url(#default#homepage)"; 
document.links[0].setHomePage(args); } else if (command == "addFavorite")
{ args = args.split("|"); window.external.AddFavorite(args[0], args[1]);
最后,如果html里一个链接都 没有,还需在<SCRIPT LANGUAGE=javascript>这句的前面添加一句

<a href="javascript:"></a>


该文章出自《莫名猪哥》,原文链接:http://www./read.php/9.htm

转载时间是: 2010-08-20 08:46:33 请务必保留此链接,谢谢!

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多