Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Passing a javascript function to Flash

How do you pass a javascript function from HTML to Flash?



8:56 pm on Aug 15, 2006 (gmt 0)

10+ Year Member

I have a web page (Page 1) that shows a house for sale. You can click on a "Map" link on the page to show a pop-up window map of the area (Page 2). When you click on a different property within the map, the property on the referring page (Page 1) changes.

Here's part of the script in the map page (Page 2) that enables this:

function mapClick(PID) {
if (window.opener &&!window.opener.closed) {
window.opener.location.href = 'http://www.mywebpage.com/properties.asp?PID='+PID;

And to call it: href="javascript:mapClick(89)" where 89 is the property ID (PID).

Now I want to convert the map to a Flash map. Would I still keep the mapClick(PID) function in the map page HTML, then feed the PID variable to Flash via FlashVars? Then in the Flash use something like:

on (release) {

Would this work? I can define the mapClick function in the html on the map page (Page 2) but I'm not sure if my Flash will recognize the mapClick function.

Any help or guidance would be deeply appreciated.


1:40 pm on Aug 17, 2006 (gmt 0)

10+ Year Member

did you try it? or are you waiting before you do?

yes, the mapClick function should stay on Page2 (same page aS the swf for the map would be)

the getURL call with the javascript: should work like that.


Featured Threads

Hot Threads This Week

Hot Threads This Month