Make swf file a link using Jquery

寵の児 提交于 2019-12-25 08:22:08

问题


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!


回答1:


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)



来源:https://stackoverflow.com/questions/3838243/make-swf-file-a-link-using-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!