ExternalInterface in its essence is a set of API which allows one to communicate seamlessly between ActionScript and the Flash Player container. As simple as it may sound, this new class in Flash8 is revolutionary in many ways. In previous versions of Flash, JavaScript communication was done via fscommand. But with the introduction of ExternalInterface it is now possible to call a JavaScript function from Flash directly and send any number of arguments in most of the data types, and the JavaScript function can send data back to Flash and is received by Flash almost immediately. This new strength has not only made the application more dynamic, but also has made flash game development all the more exciting.
Thanks to ExternalInterface, creation of a connection between a Flash ActionScript and JavaScript has become quite simple now. The whole thing can be executed in a few simple steps. The first thing one need to do is to import the ExternalInterface class by adding a simple import command at the top of the chart class. To create the callbacks that will allow JavaScript to call ActionScript methods, the addCallback method is used. This is a static method of the ExternalInterface class that takes three parameters. The first parameter is a string that interprets the name of the method which JavaScript will call. The second method is the object instance to which the call is related. The third parameter is a reference to the method that is being called in that object instance. More over, this new class can be integrated with all the major web browsers. All these has made ExternalInterface an integral part of the new-age flash web development.
In fine, the ExternalInterface has turned Flash into a truly dynamic web application. Be it a robust object-oriented procedure or a simple flash graphic design, because of The ExternalInterface it is now possible to connect them to the outside world by binding them to databases and other server-side processes.
This article is written by a technical writer, working at Synapse, We provide the complete solution of flash game development and flash web development.
Source: http://www.articlebin.com
No comments:
Post a Comment