htmlcssflashclicktag

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!


Solution

  • 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)