FLASH页面连接代码:

on(release){

getURL(" http://wenwen.soso.com/z/UrlAlertPage.e?sp=Shttp%3A%2F%2Fwww.baidu.com","_self");

}

 FLASH添加收藏代码:

 

一,用getURL的方法: 

首页:

on (release)

{

getURL("javascript:void(document.links[0].style.behavior='url(#default#homepage)');

void document.links[0].setHomePage('http://www.flashempire.com/');", "_self", "POST");

}

收藏夹:

on (release)

{

getURL("javascript:void window.external.AddFavorite('http://www.flashempire.com','闪客帝国');", "_self", "POST");

}

二,用fscommand的方法,有点复杂

1,先在flash的按钮上添加代码:

首页:

on (release) {

fscommand("setHomePage", "http://www.flashempire.com/");

}

收藏夹:

on (release) {

。。。。。。。。。。。。

/Files/net2/men.swf 

 

 

 

 

 

flash中设为首页的代码添加方法

  在网上搜索了不少,答案都是不准确的,始终没有找到很好的解决方案。不过自己用了一个小把戏来实现了FLASH设为首页,而且各个浏览器中均可以实现。

  用层的相对来定位,当然这个工作不需要FLASH设计人员来实现,只要在场景里面有设为首页几个字即可,不需要添加任何AS代码。

 
1 <div id="flashArea">
2     <div id="setArea" onclick="setHomepage();"></div>
3         <object>中间为插入的FLASH</object>
4 </div>

因为是相对于FLASH层来定位,所以一定要把要定位的层插入在FLASH层里面,这样他的父级DIV就是FLASH。

JS代码如下:

01 <script type="text/javascript">
02  function setHomepage()
03 {
04  if (document.all)
05     {
06         document.body.style.behavior='url(#default#homepage)';
07         document.body.setHomePage('http://liupeng.us/');
08     }
09     else if (window.sidebar)
10     {
11     if(window.netscape)
12     {
13          try
14    {
15             netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
16          }
17          catch (e)
18          {
19     alert( "该操作被浏览器拒绝,如果想启用该功能,请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true" );
20          }
21     }
22     var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
23     prefs.setCharPref('browser.startup.homepage','http://liupeng.us/');
24  }
25 }
26 </script>

CSS代码:

 
1 #flashArea{ margin:0px auto; width:800px; height:600px; position:relative; z-index:99;}
2 #setArea{ height:60px; width:60px; background-color:#000; position: absolute; top:150px; left:137px; z-index:1000; cursor:pointer;/*-moz-opacity:0;opacity:0;filter:alpha(opacity=0);*/}

 

 

 posted on 2010-08-06 11:29  ddxgc  阅读(286)  评论(0)    收藏  举报