You can use Actionscript to call a Javascript Function:
The JS:
function sayHello(data){
alert("Hello, "+data.name);
}
The AS:
ExternalInterface.call("sayHello",{name:"John Doe"});
Or, you can do the reverse and use JS to call an AS function
The AS:
ExternalInterface.addCallback("sayHello",function(name:String){
trace("Hello, "+name)
});
The JS:
myFlashMovie.sayHello("John Doe");