With the advent of ActionScript 3.0 and Flash CS3, Adobe took out the possibility of direct access between AS2 and AS3 clips. The next option (besides communication through servers and web services) is local connection. Until now, if you’d create a clip in Flash MX2004 or Flash 8, using AS2, and inside that clip you would load another .swf file (that too created with AS2), both clips would be able to have access to each other’s objects and functions. This is not the case anymore with the new AS3 files. An AS3 clip will not be able to access any objects or functions defined in the AS2 file that it has loaded, and the loaded AS2 file will not be able to access objects and functions defined in its’ parent, the AS3 clip. The only way for the two movie clips to communicate is to use the LocalConnection class. For an unexperienced user this could be a little troublesome: loading the AS2 file, verifying that it’s been correctly loaded, creating LocalConnection objects in both files and trying to connect them in order to be able to execute functions defined inside those files and on the objects existing in those files.
For this reason we developed the ActionScriptBridge components (ASBTerminal for AS2 and ASBContainer for AS3), to ease the work needed to be done so the two AS2 and AS3 movie clips could communicate. The user has only to drag and drop an instance of the components in the AS2 and AS3 clips, define the functions he needs to call and use the run method of the components to call the defined functions.
Now this is still a beta version, but it’s working pretty well. The ASBContainer loads an external AS2 .swf file and the two clips attempt to communicate with each other using LocalConnection objects. The user has only to set the instance names for the two component instances and set the source file to the ASBContainer instance. All the rest is done by the two components: loading the AS2 file and initiating the communication. The connection name for each of the LocalConnection objects is set automatically by the ASBContainer instance. Each connection has a uniquely generated name, encrypted using MD5. Once the ASBContainer has established a communication channel with the ASBTerminal instance, it will not accept any other connection. Each ASBContainer instance should load its’ own AS2 file and there shouldn’t be two ASBContainer instances loading the same file.
Further development will depend on user feedback on this project, so any ideas or comments are welcome.