让Flash全屏and设为首页和收藏夹功能---谭石南

注意了:在ctrl+enter下看不到效果的,要运行生成的文件才能看到效果哦 呵呵

fscommand("fullscreen","true");
//fscommand("allowscale","flase");//保持比率
//fscommand("showmenu","false"); //菜单

 

//这个也行

getURL("FSCommand:fullscreen", true);

 

 

问: 如何用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 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> <!-- Inject Script Filtered -->

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值