Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jashsayani

macrumors 6502
Original poster
Feb 7, 2009
299
130
Redwood City, CA
Hi,

This is not really Mac programming but I am posting it here as there is no specific section for "Web Programming". And I love getting responses from the MacRummors community.

Here's my question: I have an SWF object embedded in a HTML page and want to navigate to a URL when the SWF object is clicked. How do I do that ?

Maybe use a DIV tag and embed the object inside DIV. Call a small Javascript function in the "onclick" event of DIV tag or something ??

Pls help me out. Thanks.
 
How about placing the object inside a container and adding a link to the container ?

Can't you just wrap the Div in <a href=""><div><object src="swf.swf"</object></div></a>

Something like that anyway, can't even remember if you use the object tag for that purpose :eek:
 
This is not really Mac programming but I am posting it here as there is no specific section for "Web Programming". And I love getting responses from the MacRummors community.

Here's my question: I have an SWF object embedded in a HTML page and want to navigate to a URL when the SWF object is clicked. How do I do that ?

You must not have looked far enough down, there's a Web Design & Development forum here. I've asked mods to move this there.

As to your question, within the Flash you can do,
PHP:
on (release) { 
getURL ("http://www.mofunzone.com/","_self"); 
}
 
You must not have looked far enough down, there's a Web Design & Development forum here. I've asked mods to move this there.

As to your question, within the Flash you can do,
PHP:
on (release) { 
getURL ("http://www.mofunzone.com/","_self"); 
}

That'll work IF the OP has the original .fla file to open up. Sounds like he may only have a .swf though.

I know it's an ugly way to do it, but how about an image map area over the top of the swf?
 
Either you need the link in the flash like stated above. Or you should use clicktag (if you're going to change the URL it's the better route as you don't have to edit the Flash each time you change the link destination).

There's a tutorial here:
http://www.adobe.com/resources/richmedia/tracking/designers_guide/

Or if you search for clickTAG you'll find lots of help.
This is the method advertising networks use to track link referrals.
 
Can't you just wrap the Div in <a href=""><div><object src="swf.swf"</object></div></a>

Something like that anyway, can't even remember if you use the object tag for that purpose :eek:

That wouldn't be valid. "a" is an in-line element, and "div" is block. You can't put a block inside an in-line.

One wicked idea -- in other words, "don't try this at home kids" -- would be to put an invisible div directly on top of the flash chart and set the onclick handler for that.

I did this one time to do the reverse: prevent users from clicking on the flash chart.

You would have to set the position to absolute (assuming that the invisible div and object both have the parent element) and then set the z-index to a large number.
 
Well, I had made the banner for a client and he wanted a link, after a few days of completion. So, I was looking for a solution. But nothing worked, so I updated the FLA file with the AS code.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.