"You are the embodiment of the information you choose to accept and act upon. To change your circumstances you need to change your thinking and subsequent actions." - Adlin Sinclair

AS3 Calls to JavaScript

By Tommy Leung on 08/26/2008 in Games

I don’t write nearly as much programming help posts than I could be. There seems to be so much of them out there as it is. However, when I come across something that I think isn’t all that well known or clearly discussed, I feel compelled to release that information into the great unknown of the Internet.

So, I was doing a project that needed a Flash movie–coded in AS3–to make some calls to JavaScript for functionality that JavaScript is more capable of doing. There are various FSCommands that you can use in ActionScript but, nothing really suited my needs. I had some JavaScript functions that needed to be called when certain things happened in the Flash movie.

The quickest method I found for doing this is simply using navigateToURL(). You simply make a call to javascript:FUNC()wth target of _self. More specifically:

navigateToURL("javascript:FUNC()", "_self")

That’s it. :)

By Tommy Leung

Share/Bookmark

Reader's Comments

  1. Rick Boyer |

    Do you do blogroll exchanging? If you want to exchange links let me know.

    Email me back if you’re interested.

CommentComment