Have your SWF bring its own JavaScript

You can pass all sorts of JavaScript code into the first parameter of ExternalInterface.call(), not just names of already existing functions. Ie. you can inject your own JavaScript code into the HTML page that contains the Flash object. And to make life easier, you can embed the JavaScript code as XML.

Eg.
var JS: XML =
  <![CDATA[
    function() {
      if (typeof(myGlobalFunction) == "undefined") {
        myGlobalFunction = new function(text) {
          alert(text);
        }
      }
    }
  ]]>

if (ExternalInterface.available) {
  ExternalInterface.call(JS);
  ExternalInterface.call("myGlobalFunction", "Hello World!");
}