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.
janimeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.