Make swf file a link using Jquery
I've been sent a swf file for a banner that needs to be linked to a url. I am adding t开发者_如何学Pythonhis 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)
精彩评论