BB1
BB1

Reputation: 1

Adding an outside link to a SWF file

I have an ad to place with a link to their website, however I am unfamiliar with SWF files. I did find some code on the internet and have managed to get the banner displaying, but I don't know how to link it. I realise it's not your standard type of link. I'm desperately hoping that someone can advise me—I only have standard HTML skills. Here is the code.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash swflash.cab#version=7,0,19,0" width="720" height="90">
 <param name="movie" value="http://www.mydomain.com.au/fa-720x90.swf" />
 <param name="quality" value="high" />
 <embed src="http://www.mydomain/fa-720x90.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="720" height="90">
 </embed>
</object>

Upvotes: 0

Views: 5062

Answers (2)

grapefrukt
grapefrukt

Reputation: 27045

Typical procedure when embedding a third party banner on your site that needs tracking is to use what is called a clickTag, this is supplied as an argument to the banner which then has code to use that variable instead of a hardcoded url.

Many banner networks have documentation that makes the clickTag out to be somekind of mythical beast but in reality it's a simple variable that just happens to be named clickTag.

Assuming your banner was made (or can be made) to support this the easiest way is to supply the variable as a query string to the SWF:

http://www.mydomain.com.au/fa-720x90.swf?clickTag=http://www.foo.com

Note that the swf url is in two places in the embed code.

Upvotes: 1

James Allardice
James Allardice

Reputation: 165971

Unless you have access to the .fla file so you can modify the SWF, your best bet is to lay a transparent div over the embedded SWF, by positioning it absolutely, and listen for clicks on that, instead of the SWF itself:

document.getElementById("example").onclick = function() {
    window.open("http://www.somewhere.com"); 
}

Here's a working example: http://jsfiddle.net/ekHJH/5/

Upvotes: 1

Related Questions