在嵌入的 Flash 文件周围添加链接

发布于 2024-08-19 13:08:36 字数 589 浏览 5 评论 0原文

我希望这样当我单击嵌入的 Flash 元素上的任意位置时,它会将我带到目标 URL。

这是我当前的代码,它没有产生所需的效果:

<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>

现在,它使 .swf 文件后面的空间可单击链接,但 Flash 元素不可单击。

如果正确的做法是以某种方式编辑 .swf 文件,请告诉我。我不认为自己是 Flash 开发人员,但是有关于从哪里开始或如何使用现有 .swf 文件执行此类基本操作的资源吗?

非常感谢任何建议!

I want to make it so that when I click anywhere on the embedded Flash element, it takes me to a destination 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.

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?

Any suggestions are much appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

时光匆匆的小流年 2024-08-26 13:08:37

我遇到了同样的问题,找到了这个线程,但最终创建了我自己的解决方案。

我向链接添加了透明元素,然后使其与嵌入的 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>

注意 - 您可能应该将 css 包含在单独的文件中以用于生产代码。

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

<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.

空‖城人不在 2024-08-26 13:08:37

更多研究后更新:

这个问题之前已经被问过,并且最佳答案是您必须在 Flash 中创建链接。

通常,这是通过将参数(通常称为 clickTAG)传递给 .swf 以告诉它链接到哪里来动态完成的。

对于您的情况(因为其他人提供了您的 swf 文件),我可以看到 2 个选项:

  1. 您的 .swf 作者可能已经实现了 clickTAG 方法(您可以询问他们,或者只是在 .swf 上尝试一下,看看它是否有效。)
  2. 您可以制作一个实现 clickTag 的 Flash 包装文件,并让它加载并显示您的 .swf 文件。我知道这看起来像黑客,但我看不到任何其他选择。

希望这有帮助!


我也见过类似的东西[编辑:但我无法让它工作!谷歌搜索表明这是不可能的]

<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>

(例如此处

Update after more research:

This question has been asked before, and the best answer is that you have to create the link within flash.

Usually this is done dynamically by passing a parameter (conventionally named clickTAG) to the .swf to tell it where to link to.

In your case (since someone else provided your swf files) I can see 2 options:

  1. 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.)
  2. 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.

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)

蝶…霜飞 2024-08-26 13:08:37

使用 z-index 将透明的 .gif 或 .png 文件放在 Flash 上,然后用您的 URL 锚定该透明图像。

Put a transparent .gif or .png file over the flash using z-index and just anchor that transparent image with your URL.

暖心男生 2024-08-26 13:08:37

您可以创建自己的 swf(或让别人为您做),其中有一个可编辑的按钮 FlashVars 在舞台上,并在该按钮下方加载您的主题 swf。

我为您创建了一个:下载

您只需在嵌入时添加两个 FlashVar:

  1. url - 单击 swf 时将访问的 URL。
  2. swf - 要加载的 swf 文件。

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.

I've created one for you: Download.

You just need to add two FlashVars when you embed it:

  1. url - The URL that will be visited if the swf is clicked.
  2. swf - The swf file to load.
祁梦 2024-08-26 13:08:37

我很想解决这个问题......我尝试了几种技巧,包括 jquery 和 javascript。

当然,在所有浏览器中都有效的解决方案就是我回复上面的解决方案。

感谢用户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>

I got mad to solve the issue.... I tried several tricks including jquery and javascript.

Definitely the SOLUTION that works and works in ALL browser is the one above my reply.

Thanks user 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>
柠檬色的秋千 2024-08-26 13:08:37

我找到了一个最好的方法

<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.*/
         }

https://gist.github.com/m-pokrovskii/6558817

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.*/
         }

https://gist.github.com/m-pokrovskii/6558817

無心 2024-08-26 13:08:37
<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>

当然
消除所有情况下的问题

<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

潜移默化 2024-08-26 13:08:37

这对我有用:

<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>

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>
后来的我们 2024-08-26 13:08:37

谢谢你!
现在。它起作用了

    <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>

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>
原来是傀儡 2024-08-26 13:08:37

您无法向 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>

在我的例子中,对象是由脚本嵌入的,但它应该工作相同。
您必须将对象和带有图像的div包裹在相对div中,然后将div定位为绝对,图像按左、上对齐、 right 和bottom 属性,并指定z-index 属性来重叠图像。

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:

    <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 absolute the div with the image aligning it by left, top, right and bottom properties, and asigning z-index property to overlap the image.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文