Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a Link Around an Embedded Flash File

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!

like image 218
JWM Avatar asked Jan 22 '10 17:01

JWM


3 Answers

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.

like image 130
Gary V Avatar answered Nov 15 '22 16:11

Gary V


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)

like image 28
Richard Inglis Avatar answered Nov 15 '22 17:11

Richard Inglis


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

like image 45
GreaseJunkie Avatar answered Nov 15 '22 16:11

GreaseJunkie