View Single Post
  #2 (permalink)  
Old December 15th, 2006, 04:39 PM
jberg jberg is offline
Registered User
 
Join Date: Dec 2006
Location: , , USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

Your attempt is spot on. However, there's a caveat to what you are attempting.

In your original JavaScript, "onclick" is an event handler defined as an attribute of the <a> tag within the document object model of the web page. So the browser does the heavy lifting for you by associating this event with that specific <a> tag.

So what we need to do is take the contents of that onclick event and apply it to a new event. In this case we want the event to be controlled by the getURL event within Flash.

In this case, as long as the Flash is on the same page as where the function swapLayers is available, we can do the following.

Code:
getURL("javascript:swapLayers('layer');");
I am not quite sure why the return false exists at the end of the statement, so I removed it. If you are afraid IE will enact upon some return value via this getURL call then you should use the following syntax to void the return.

Code:
getURL("javascript:void(swapLayers('layer'));");

Reply With Quote