在Flash中实现设为首页和加入收藏夹
2006-06-19 12:32
211 查看
现在很多的网站不管是大型的网站还是小的个人主页都有设为首页和加入收藏夹的功能,尽管实用性值得探讨但还是为网页增加了效果。那么在Flash动画中能不能也增加这样的功能呢?又应该如何实现这两个功能呢?下面来学习如何实现这两个效果。
在Flash中我们是通过ActionScript脚本来实现这两个效果,即将页面设为首页和加入收藏夹这里有两种方法。 第一种方法是通过按钮的getURL实现,只要在按钮上加入相应的ActionScript脚本即可。脚本如下:
设为首页
on (release) { getURL("javascript :void(document.links[0].style.behavior=''''''''url(#default#homepage)'''''''');void document.links[0].setHomePage(''''''''http://您的网站地址/'''''''');", "_self", "POST"); }
加入收藏夹
on (release) { 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]);
在Flash中我们是通过ActionScript脚本来实现这两个效果,即将页面设为首页和加入收藏夹这里有两种方法。 第一种方法是通过按钮的getURL实现,只要在按钮上加入相应的ActionScript脚本即可。脚本如下:
设为首页
on (release) { getURL("javascript :void(document.links[0].style.behavior=''''''''url(#default#homepage)'''''''');void document.links[0].setHomePage(''''''''http://您的网站地址/'''''''');", "_self", "POST"); }
加入收藏夹
on (release) { 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]);
相关文章推荐
- 在flash中实现[设为首页]和[加入收藏]
- Flash加入收藏夹,设为首页等使用函数
- js将网站 加入收藏夹与设为首页方法实现
- Flash加入收藏夹函数,设为首页函数,判断输入是否为数字的函数
- 如何在FLASH中实现加入收藏夹的效果
- 设为首页JS,加入收藏夹js,加入收藏夹代码,设为首页代码,火狐和ie兼容
- javascript加入收藏夹 设置首页
- 如何实现"设为首页","加入收藏"的功能
- 带你实现开发者头条APP(四)---首页优化(加入design包)
- html实现“设为首页”加入收藏”代码
- 如何实现"设为首页","加入收藏"的功能
- 兼容FF 加入收藏夹和设为首页
- 在Flash 设为首页 加为收藏实现代码
- asp.net中怎样实现设为首页和加入收藏的功能我用的是用LinkButton控件 点击Text为设为首页的LinkButton实现
- JS实现设为首页与加入收藏
- js实现设为首页和加入收藏
- 如何实现"设为首页","加入收藏"的功能
- js实现html中的收藏或加入首页
- 网站首页的轮播新闻flash效果实现
- 实现 加入收藏和设为首页的代码