homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

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

5+ Year Member

Msg#: 3047621 posted 8:56 pm on Aug 15, 2006 (gmt 0)

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.



5+ Year Member

Msg#: 3047621 posted 1:40 pm on Aug 17, 2006 (gmt 0)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved