External Communications with Flash 8: How to Use the ExternalInterface
- Connecting ActionScript and Other Languages
- The ExternalInterface Class
- The Container
- The JavaScript Connection
- The ActionScript Connection
- Handling Unsupported Browsers
- Summary
Connecting ActionScript and Other Languages
A few new classes in Flash 8 push it beyond previous versions by providing external communication with other technologies. Developers have been coding workaround external communication solutions for years, but this time Flash got it right with a few new classes, one of which is called ExternalInterface. This class provides an interface that allows direct communication between ActionScript and other languages.
In this article, you’ll learn how to use the ExternalInterface class to communicate between ActionScript and JavaScript. We’ll update a sample I created for a previous article—a bar chart based on mortgage company statistics. Instead of explaining every detail of the application, I’ll focus on how to create the connection between an existing Flash application and the AJAX engine. The updated sample for this article can be found here, along with a live sample, which can be viewed here.