使用jquery使swf文件成为一个链接 [英] Make swf file a link using Jquery

查看:180
本文介绍了使用jquery使swf文件成为一个链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经发送了一个swf文件,用于需要链接到网址的横幅。我将这个添加到我的客户的网站,我的客户已经发送了瑞士法郎和JavaScript添加到页面。问题是,JavaScript代码是过于复杂,我想要使用JQuery和Unobtrusive Flash对象(我还没有更新到这个网站swfobject)。我可以使用JQuery和/或UFO(或者,如果我必须升级,确实是swfobject)使swf文件链接到一个外部URL(最好加载一个新的选项卡/窗口)?我没有任何ActionScript或Flash的知识。任何帮助,将不胜感激!


解决方案

您需要创建的Flash文件中的链接,使用动作脚本。



这是很容易做到这一点,检查出的在这里回答



或者,像这样的东西可能工作。基本上是透明的锚定标记是在该快闪横幅位置。



 变量$闪光= $(#ID-的闪光对象标签)。 
$变种的Flashlink = $( < A /> 中)
.attr(的 href, http://www.google.co.nz)
的CSS ({
'position':'absolute',
'width':$ flash.width(),
'height':$ flash.height(),
'top ':$ flash.offset()。top,
'left':$ flash.offset()。left
});
$(body)。append($ flashLink);

您可能需要将对象标记的wmode更改为transparent。

(这尚未经过测试)


I've been sent a swf file for a banner that needs to be linked to a url. I am adding this to my client's website and my client has been sent the swf and javascript to add to the page. The problem is that the javascript code is overly complex, and I'm wanting to use Jquery and Unobtrusive Flash Objects (I've not yet updated to swfobject on this site). Can I use Jquery and/or UFO (or indeed swfobject if I have to upgrade) to make the swf file link to an external url (preferably loading in a new tab/window)? I don't have any knowledge of actionscript or flash. Any help on this would be appreciated!

解决方案

You need to create a link inside the Flash file, using Action Script.

It's pretty easy to do this, check out the answer here.

Alternatively, something like this might work. Basically a transparent anchor tag that is position over the flash banner.

var $flash = $("#id-of-flash-object tag").
var $flashLink = $("<a />")
    .attr("href", "http://www.google.co.nz")
    .css({
        'position': 'absolute',
        'width': $flash.width(),
        'height': $flash.height(),
        'top': $flash.offset().top,
        'left': $flash.offset().left
    });
$("body").append($flashLink);

You might need to change the wmode of the object tag to "transparent".

(this hasn't been tested)

这篇关于使用jquery使swf文件成为一个链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆