Recently it seems I have come to a new phase of my Flash life, where Flash alone is not enough. Previously I have used flash in conjunction with XML, but that was by choice, not because Flash had no way of achieving the outcome desired. In the last month there have been two projects which use both Flash and JavaScript together. This was a small problem as I am not all that familiar with JavaScript. So after a little help from our programming team we discovered a lovely little Flash function that solved both projects problems.
Project (a) required Flash to react on a JavaScript call. For this I used the ExternalInterface function but with the addCallback call. For example:
ExternalInterface.addCallback("nameofjsfunction", this, nameofflashfunction);
So when the JavaScript function is called, then Flash reacts by performing its allocated function.
Project (b) was required to call a JavaScript function upon a user interaction within the Flash.
This was simply done by using the same ExternalInterface but this time using the call, call. When this call is made in the Flash, then it activates the JavaScript function which would be located in your HTML or equivalent file.
In both of these instances the following needs to be added into Flash
import flash.external.*;
at the beginning in order for this function to work.






