/ Published in: ActionScript 3
Short and sweet, add the following two lines where you want to trigger a javascript function. Just change the javascript denoted in the code by "javascriptFunction()" with whatever you want to call. Also jsut in case make sure you have the allowScriptAccess parameter set to "always".
Expand |
Embed | Plain Text
var runJavascript:URLRequest = new URLRequest("javascript:javascriptFunction()"); navigateToURL(runJavascript, "_top");
Comments
Subscribe to comments
You need to login to post a comment.

Do we need the "_top" thing there?
Hey jirirybar, the second parameter works much like the target attribute of a link in HTML. If you don't specify one the default is to trigger this action in a new window (and in my opinion ruining the purpose of this snippet). That said I use "top" most of the time but have had to use "parent" on occasion when the flash was in an iframe. Hope that helps!