2011-09-26 43 views
0

是否有跨浏览器解决方案可用于为Flash横幅提供HTML链接,而无需将其放入Flash本身? (即Flash中没有可点击的按钮)Flash横幅广告,如何为其提供(外部)html链接

我试着给周围的锚点标签设置一个高z-索引,但没有奏效。我使用标准的谷歌swfobject包括闪光横幅,但我没有坚持使用。

谢谢

回答

1

总是可以让Flash处理点击并通过ExternalInterface传递给Javascript。然后让您的Javascript响应通话并将用户移至新位置。请注意,这只有在用户启用Javascript的情况下才有效。

Javascript代码:

function myCustomFlashCallMethod() 
{ alert("Hello world!"); } 

闪存代码:

addEventListener(MouseEvent.CLICK, onMouseClick, false, 0, true); 

function onMouseClick(event:MouseEvent):void 
{ 
    if (ExternalInterface.available) 
    { ExternalInterface.call("myCustomFlashCallMethod"); } 
} 

ExternalInterface类参考: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html

Adob​​e的 “使用ExternalInterface的” 写了: http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7cb2.html

+0

我明白了,谢谢。有什么办法可以在Flash之外处理它吗? – Ray

+0

如果您不知道某种方式,请让我知道此代码吗?谢谢。 – Ray

+0

查看我的更新回答。 – meddlingwithfire

1

是的,有!这是使用方法:

将您的Flash横幅旁边(不是内部)的锚标记,并设置其的wmode =“不透明”。您还需要设置锚标签的位置,显示和z-index样式。

<div style="position:relative;"> 
    <a href="http://your-target-url" style="position:absolute; top:0; left:0; display:block; width:100%; height:100%; z-index:100;">&nbsp;</a> 
    <embed src="your-flash-banner" type="application/x-shockwave-flash" wmode="opaque"></embed> 
</div> 

编辑:要在IE工作,你必须使它升技脏。添加这些样式的锚标记过一个:

background:url(spacer.gif);

spacer.gif的地方是1px的透明的gif。

background-color:#ffffff; /* the background   */ 
filter:alpha(opacity=0); /* Internet Explorer  */ 
-moz-opacity:0;   /* Mozilla 1.6 and below */ 
opacity: 0;    /* newer browser and CSS-3 */ 

这是另一个IE错误,不接受与显示透明链接的点击:块。