You don’t have to do anything special in your JavaScript code in order to receive function calls from Flash. As long as the required JavaScript files are included in the page, JavaScript functions can be invoked from Flash with any number of arguments.
You can have Flash invoke functions on a specific scope (other than the default document scope) by passing in a reference to the desired scope when creating an instance of the FlashProxy object, like this:
var flashProxy = new FlashProxy(uid, 'myFlashContent', '/path/to/JavaScriptFlashGateway.swf', callback);
Flash will now invoke functions on the instance of “callback”. This last argument is entirely optional. If it is not included, the default scope is the document.