Flash / JavaScript Integration Kit (Beta)

The Flash / JavaScript Integration kit makes it possible to seamlessly communicate between Flash and JavaScript. You can call JavaScript functions from Flash, and ActionScript functions from JavaScript.

License

The Flash / JavaScript Integration kit is released under an open license (modeled after the Apache 1.1 license). You can view the complete license here.

FAQ

Q: Why did you create the Flash / JavaScript Integration Kit?
A: This integration kit allows developers to combine the best of HTML and Flash into a single application.

Q: Wasn't it already possible to combine JavaScript and Flash?
A: While there have been ways to communicate between JavaScript and Flash in the past, they have not worked reliably across browsers and/or platforms. Furthermore, these techniques only allow you to pass strings between JavaScript and Flash, and not complex data types such as objects and arrays.

Q: What browsers does the kit work in?
A: The kit has been tested in the following browsers:

Q: Which Flash Player version is required?
A: JavaScript to Flash communication requires Flash Player 6,0,65,0 or above. Flash to JavaScript communication requires Flash Player 6,0,0,0 or above.

Q: Is it possible to get JavaScript to Flash communication to work in Flash Player versions earlier than 6,0,65,0?
A: Yes. Simply open up the JavaScriptFlashGateway.fla file, then open the Flash publish settings window (File > Publish Settings > Flash). Uncheck the "Optimize for Player 6 r65" check box and recompile the SWF.

Q: Does the integration kit work with Macromedia Flex?
A: Yes, the integration kit has been tested with SWFs generated by both Macromedia Flex and Flash MX 2004.

Q: What data types can I pass between Flash and JavaScript?
A: The following data types are supported:

Arrays and objects can contain any of the supported data types, and references can be nested.

Q: Are there any limitations on the amount of data I can send?
A: There is a limit to the amount of data that can be sent from JavaScript to Flash, but the specific amount depends on the data being sent. If you send a very large amount of data, and the call fails, try sending a smaller amount. When sending data from JavaScript to Flash, the limit of serialized data that can be sent is approximately 40K.

We are not aware of any limits in the amount of data that can be sent from Flash to JavaScript.

Q: Can I get a return value from an ActionScript function when called from JavaScript, or vice versa?
A: Not currently, although we are looking at ways of making this possible in future versions.

Q: Do you have any live examples of the Integration Kit in action?
A: Yes, we do. Check out the MXNA Category Click Feed Report. You can view the source by right clicking on the application, and selecting "View Source".

Q: Will the JavaScript and Flash Integration Kit be updated?
A: Yes. The kit is actively developed as an open project hosted by osflash.org.

Q: I found a bug, where can I submit it? I have a feature request, where can I submit it?
A: You can submit any bugs, issues or feature requests at the development site.

Q: Is there a mailing list where I can ask questions about or discuss the kit?
A: Yes. You can subscribe to the Flash / JavaScript mailing list here.

Q: Where can I find more information on developing for the Flash Platform?
A: You can find more information about the Flash Platform at the Macromedia Flash Platform center.

Feedback

This project was created and written by Christian Cantrell and Mike Chambers at Macromedia.