tags:

views:

3331

answers:

4

Is it possible to use a flash document embedded in HTML as a link?

I tried just wrapping the object element with an a like this:

<a href="http://whatever.com"&gt;
    <object ...>
        <embed ... />
    </object>
</a>

In Internet Explorer, that made it show the location in the status bar like a link, but it doesn't do anything.

I just have the .swf file, so I can't add a click handler in ActionScript.

A: 

You could use Javascript to add a handler (added inline for brevity):

<object onclick="window.location='URLHERE';return false;">

That should work, methinks.

Brian Warshaw
+1  A: 

Though the object really should respond to being wrapped in an a href tag, you could open the swf in vim and just throw in an _root.onPress=function(){getURL("http://yes.no/");}; or if it's AS3, something like _root.addEventHandler(MouseEvent.PRESS, function (e:event) {getURL("http://yes.no/");}); But if editing the swf is your route, you'd likely have more success with a tool for the purpose.

dlamblin
A: 

As an addition to dlamblin's answer it is often best to use the clickTAG technique to open URLS from a flash movie.

More information can be found here:

http://www.adobe.com/resources/richmedia/tracking/designers_guide/

The advantage of using the clickTAG technique is that you can set the URL to jump to in the HTML page.

This means that you can set the flash movie to link to different places without modifying the flash file (beyond adding the initial clickTAG code). You can use link tracking on the URL as well.

Tim Saunders
A: 

You could use Javascript to add a handler (added inline for brevity):

That should work, methinks.

This worked for me but the litle hand for clicking stuff doesn´t appear. The link works though

s0natagrl
What browser were you using? I haven't been able to get that to work.
Matthew Crumley