flash中的常用代码
|
昨天有朋友在MSN上问我如何实现一打开网页,就让SWF文件全屏的效果,我记得以前好像曾经在坛子里发过这样的贴子,没去找,呵呵,没时间啊 ~~ <script language="JavaScript">
<!-- window.open("nfd.swf","","fullscreen=1,menubar=no,width=100%,height=100%") //--> </script> 第二种方法: 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") 我个人推荐这种^_^ 第三种方法: <html> *.htm 你把他替换为 你自己要全屏打开的网页就可以了<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> 第四种方法: <html>
<frameset rows="100%,*" framespacing="0" frameborder="no" border="0"> <frame name="top" src="http://edu.cnzz.cn/NewsInfo/动画名.html" frameborder="0" border="0" marginwidth="0" marginheight="0" leftmargin="0" rightmargin="0" topmargin="0"> <frame name="blank" src="http://edu.cnzz.cn/NewsInfo/blank.html" frameborder="0" border="0" marginwidth="0" marginheight ="0" leftmargin="0" rightmargin="0" topmargin="0"> </frameset> </html> 该文件将页面分为两个框 架,上面放http://edu.cnzz.cn/NewsInfo/动画名.html文件,下面放http://edu.cnzz.cn/NewsInfo/blank.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> 上面的第四步和第三种方法一样的 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>
源代码网供稿. |
