Html 在嵌入式 Flash 文件周围添加链接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2119296/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Add a Link Around an Embedded Flash File
提问by JWM
I want to make it so that when I click anywhere on the embedded Flash element, it takes me to a destination URL.
我想让它当我点击嵌入的 Flash 元素上的任何地方时,它会把我带到一个目标 URL。
Here is my current code, which does not produce the desired effect:
这是我当前的代码,它不会产生预期的效果:
<div class="contentdiv" style="margin:-72px 0 10px 0px; cursor:pointer;" onclick="location.href='http://example.com/';">
<object height="410" width="720">
<param name="movie" value="images/tri.swf">
<embed src="images/tri.swf" height="400" width="700">
</embed>
</object>
</div>
Right now it is making the space behind the .swf file clickable for the link, but the Flash element is not clickable.
现在,它使 .swf 文件后面的空间可用于链接,但 Flash 元素不可单击。
If the right thing to do is to edit the .swf file somehow, please let me know that. I don't consider myself a Flash developer, but are there any resources on where to get started or how to do something this basic with an existing .swf file?
如果正确的做法是以某种方式编辑 .swf 文件,请告诉我。我不认为自己是 Flash 开发人员,但是否有关于从哪里开始或如何使用现有 .swf 文件执行如此基本操作的资源?
Any suggestions are much appreciated!
任何建议都非常感谢!
采纳答案by Richard Inglis
Update after more research:
经过更多研究后更新:
This question has been asked before, and the best answeris that you have to create the link within flash.
这个问题以前有人问过,最好的答案是你必须在 flash 中创建链接。
Usually this is done dynamically by passing a parameter (conventionally named clickTAG) to the .swf to tell it where to link to.
通常这是通过将参数(通常称为 clickTAG)传递给 .swf 来动态完成的,以告诉它链接到哪里。
In your case (since someone else provided your swf files) I can see 2 options:
在您的情况下(因为其他人提供了您的 swf 文件),我可以看到 2 个选项:
- Your .swf author may have already implemented the clickTAG method(you can ask them, or just try it out on the .swf to see if it works.)
- You could make a flash wrapper file that implements clickTag, and have it load and display your .swf file. I know this seems like a hack, but I can't see any other alternatives.
- 您的 .swf 作者可能已经实现了clickTAG 方法(您可以询问他们,或者只是在 .swf 上尝试一下,看看它是否有效。)
- 您可以制作一个实现 clickTag 的 Flash 包装文件,并让它加载并显示您的 .swf 文件。我知道这看起来像是一个黑客,但我看不到任何其他选择。
Hope this helps!
希望这可以帮助!
I've also seen something like this used [edit: but I can't get it to work! Googling suggests that it's not possible]
我也看到过类似的东西 [编辑:但我无法让它工作!谷歌搜索表明这是不可能的]
<a href="http://example.com/" target="_blank">
<object height="410" width="720"><param name="movie" value="images/tri.swf">
<embed src="images/tri.swf" height="400" width="700"></embed>
</object>
</a>
(For example here)
(例如这里)
回答by Gary V
I had the same problem, found this thread, but ended up creating my own solution.
我遇到了同样的问题,找到了这个线程,但最终创建了我自己的解决方案。
I added transparent element to the link, then made it overlap the embeded swf
我在链接中添加了透明元素,然后使其与嵌入的 swf 重叠
<a href="http://example.com/" target="_blank">
<object height="410" width="720"><param name="movie" value="http://www.theslap.com/swf/slap_logo.swf">
<embed src="http://www.theslap.com/swf/slap_logo.swf" height="400" width="700"></embed>
</object>
<i style="display:block; height: 410px; width: 720px; position: relative; z-index: 9; margin-top: -410px;"></i>
</a>
Note - you should probably include the css in a separate file for production code.
注意 - 您可能应该将 css 包含在单独的文件中用于生产代码。
回答by GreaseJunkie
Put a transparent .gif or .png file over the flash using z-index and just anchor that transparent image with your URL.
使用 z-index 将透明的 .gif 或 .png 文件放在 Flash 上,然后将透明图像与您的 URL 锚定。
回答by Marty
You could create your own swf (or have someone do it for you) that has a button editable with FlashVars
over the stage and that loads in your subject swf underneath that button.
您可以创建自己的 swf(或让某人为您做),它有一个可FlashVars
在舞台上编辑的按钮,并在该按钮下方加载您的主题 swf。
I've created one for you: Download.
我为您创建了一个:下载.
You just need to add two FlashVars when you embed it:
嵌入时只需要添加两个 FlashVars:
url
- The URL that will be visited if the swf is clicked.swf
- The swf file to load.
url
- 如果单击 swf 将访问的 URL。swf
- 要加载的 swf 文件。
回答by Corrado Prever
I got mad to solve the issue.... I tried several tricks including jquery and javascript.
我很生气要解决这个问题.... 我尝试了几个技巧,包括 jquery 和 javascript。
Definitely the SOLUTION that works and works in ALL browser is the one above my reply.
绝对可以在所有浏览器中运行和运行的解决方案高于我的回复。
Thanks user user2628529
感谢用户 user2628529
<div class="containe">
<div style="position:absolute;"> <a href="http://www.sample.com" target="_blank" > <img src="http://www.sample.it/banner/trasparent-190-505.png"> </a> </div>
<div >
<object type='application/x-shockwave-flash' data='http://www.sample.it/banner/banner-one.swf' width='190' height='505'>
<param name='flashvars' value='clickTag=&clickTarget=_self' />
<param name='allowScriptAccess' value='always' />
<param name='movie' value='banner-one.swf' />
<param name='wmode' value='transparent' >
</object>
</div>
</div>
回答by Maxim Pokrovskii
There is a best way i've got found
我找到了一个最好的方法
<div class="flash-wrap">
<a class="flash-link" href="#"></a>
<object type="application/x-shockwave-flash" data="flash.swf" width="180" height="220">
<param name="wmode" value="opaque">
<param name="movie" value="flash.swf" />
<param name="quality" value="high" />
</object>
</div>
.flash-wrap{
position: relative;
}
.flash-link{
position: absolute; top:0px; left:0px;
width:180px; /*Flash Size*/
height:220px;
/*background: url('images/0.gif') no-repeat;*/ /*You should uncommented this line for support old IE version.*/
}
回答by gtb
This worked for me:
这对我有用:
<a target="_blank" href="{{ entity.link }}">
<object type="application/x-shockwave-flash" data="{{ entity.file.path }}?clickTAG={{ entity.link }}" width="120" height="600" style="visibility: visible;">
<param name="quality" value="high">
<param name="play" value="true">
<param name="LOOP" value="false">
<param name="wmode" value="transparent">
<param name="allowScriptAccess" value="true">
</object>
</a>
回答by Nam Nguyen
Thank You! now. It worked
谢谢你!现在。有效
<div style="width: 400px; height: 100px;">
<a href="http://www.sample.com" target="_blank">
<object height="100" width="400"><param name="movie" value="1.swf">
<embed src="1.swf" quality="high" type="application/x-shockwave-flash" wmode="transparent" width="400" height="100" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always"></embed>
</object>
<i style="display: block; height: 100px; width: 400px; position: relative;z-index: 9;margin-top: -102px;"></i>
</a>
</div>
回答by Sergio
You can't add a link to a flash object, but you can overlap a transparent image with a link, over the flash object. This is my example:
您不能向 flash 对象添加链接,但可以将带有链接的透明图像重叠在 flash 对象上。这是我的例子:
<div style="position: relative;">
<div style="position: absolute;
left: 250px;
top: 0px;
z-index: 9999;">
<a href="http://terrazasmedicina.com.ar/hometerrazas.html">
<img src="logoLinkTR.png" width="504" height="103"></a>
</div>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','1024','height','106','src','banner','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','banner' ); //end AC code
</script></div>
In my case the object is embeded by a script, but it should work the same.
You have to wrap in a relative div the object and a div with the image, and then position as absolutethe div with the image aligning it by left, top, right and bottom properties, and asigning z-indexproperty to overlap the image.
在我的情况下,对象是由脚本嵌入的,但它应该工作相同。
你必须用一个相对的 div 包裹对象和一个带有图像的 div,然后将 div定位为绝对位置,图像通过左、上、右和底部属性对齐,并指定z-index属性以重叠图像。
回答by aaydin
<div id="logo" >
<div id="linklogo" style="position:absolute;"><a href="http://www.gogle.com"><img src="transparent.png"></a></div>
<div id="flashlogo" >
<object type='application/x-shockwave-flash' data='1.swf' width='200' height='86'> <param name='flashvars' value='clickTag=&clickTarget=_self' /><param name='allowScriptAccess' value='always' /><param name='movie' value='1.swf' /><param name="wmode" value="transparent"></object>
</div>
certainly eliminates the problem in all cases
在所有情况下肯定会消除问题