• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

HTML/Javascript code to enable clicking on a SWF file and a redirection to another page

This is a re-posted question (it was posted under a wrong category).

http://www.experts-exchange.com/Software/Photos_Graphics/Web_Graphics/Macromedia_Flash/Q_25474258.html#a28408847

There is a partial solution for this. We also need to make it work under IE.

Thanks.

J.
0
janime
Asked:
janime
  • 5
  • 3
1 Solution
 
OnthraxCommented:
I would place a second DIV as an overlay on your flash object and use the onclick event of the DIV to redirect the click to the correct URL. This would work in any browser.

It would be something like this: (untested, from the head).

<div style='position:relative'>
   <div>your flash here</div>
   <div style='position:absolute; top:0px;  left:0px;z-index:1000;width:400px; height:300px' onclick='document.location="www.google.com"'>&nbsp;</div>
</div>

Hope this helps...
0
 
OnthraxCommented:
Also make sure your flash object has wmode=transparant for IE compatibility.
0
 
janimeAuthor Commented:
Hi,
this is how my code looks now.

I am not sure about wmode value.
I  tried both.
Viewing in Firefox:
  transparent - I see nothing;
  opaque - I see a white banner.
Viewing in IE:
  I see the swf file no matter what wmode value I enter.

Clicking Results:
Firefox - it seems to be working when clicked (the redirection works).
IE - still no success.

Thanks.
J.


<div style='position:relative'>
  <div>
  <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="468" height="60">
  <param name="movie" value="http://www.domain.com/images/intro.swf">
  <param name="quality" value="high">
  <embed wmode="transparent" src="http://www.domain.com/images/intro.swf" quality="high" 
  pluginspage="http://www.macromedia.com/go/getflashplayer"                                                                 type="application/x-shockwave-flash" width="468" height="60"></embed>
  </object>  
 </div>

  <div style='position:absolute; top:0px;  left:0px;z-index:1000;width:468px; height:60px' onclick='document.location="http://www.domain.com/register.php"'>&nbsp;</div>
</div>

Open in new window

0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
OnthraxCommented:
The wmode value has something to do with the way the object is displayed and helps the overlay process.

I modified the code (took me a while.. damn IE6) but this will work.

<div style='position:relative'>
  <div style="position:absolute;z-index:10;">
  <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="468" height="60">
  <param name="movie" value="http://www.domain.com/images/intro.swf">
  <param name="quality" value="high">
  <param name="wmode" value="transparent">
  <embed wmode="transparent" src="http://www.domain.com/images/intro.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed>
  </object>  
 </div>

  <div style='position:absolute; top:0px; z-index:11; left:0px;width:468px; height:60px'>
  	<div style="border:1px solid red; height:60px; width:468px;" onclick="document.location='http://www.domain.com/register.ph'"">You should see this text</div>
  </div>
</div>

Open in new window

0
 
CyanBlueCommented:
FYI, the only problem for using the EMBED tag for embedding SWF is that you have no control over the user with no Flash Player...  SWFObject takes care of that, and I used it for that specific reason...

CyanBlue
0
 
janimeAuthor Commented:
Onthrax: I tried to use the same code you posted, unfortunately it keeps shifting the design of the page.
If I use a space (&nbsp;) instead of "You should see this text" the I cannot really "click" on this as that clickable space shrinks down to that little space.
So the code you posted sort of "works" but it is just not nice.
Wouldn't it be better to put some transparent picture on top of that flash and make it clickable rather than trying to stretch out the div space (for some reason this doesn't work properly).

Thanks anyways..
0
 
OnthraxCommented:
it works fine over here.. which version of IE are you using?
0
 
janimeAuthor Commented:
ok, I solved it with that transparent picture. Thanks.
0
 
OnthraxCommented:
You're welcome :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now