RSS
10 Mar 2009

Interfacing with JavaScript from Flash using the ExternalInterface class

Author: Richard Francis | Filed under: Projects

Interfacing with JavaScript from Flash is pretty easy actually! It’s done with the help of a nifty little class called “ExternalInterface”. The process is simple; you import the class and then use the “call” method to call a JavaScript function on the parent page and parse any parameter you may want.

Here is a simple bit of actionscript demonstrating how to do this:

// Import the ExternalInterface class
import flash.external.*;

// Call the JavaScript function 'myFunction' and parse the value 'myParameter'
myMovie.onRelease = function () {
	ExternalInterface.call('myFunction', 'myParamenter');
}
If you like this post, why not bookmark it?
  • Digg
  • StumbleUpon
  • del.icio.us
  • Reddit
  • MySpace
  • Facebook
  • Google
  • Live
  • Technorati
  • Sphinn
  • Mixx
  • E-mail this story to a friend!

Leave a Reply