To accomplish what you're describing, the best way is to have Flash invoke a JavaScript function called "pingJavaScript". If JavaScript is running, that JavaScript function will then call a function on the Flash movie called "receiveJSNotification". So in your Flash movie, if that method gets called, you know JS is running.
To enable robust communication between a Flash movie and JavaScript, include this at the top of an Actionscript on the first frame of your movie:
import flash.external.ExternalInterface;
import flash.events.Event;
Add a function to receive a "yes, I'm alive" from JavaScript:
var js_available = false;
function receiveJSNotification(str:String):void {
_root.js_available = true;
}
ExternalInterface.addCallback("notifyFlash", receiveJSNotification);
ExternalInterface.call("pingJavaScript", null);
In JavaScript:
function pingJavaScript()
{
var movie = getFlash();
movie.notifyFlash();
}
function getFlash()
{
var movie = null;
if (navigator.appName.indexOf('Microsoft') != -1) {
movie = window['flashmovie'];
} else {
movie = document['flashmovie'];
}
return movie;
}