In order to communicate with ActionScript from JavaScript, we have to get a reference to the Flash object within the document the Flash movie is embeded in. It would be like so:
function getFlashObject(flashMovieId) {
var isIE = navigator.appName.indexOf("Microsoft") != -1;
return (isIE) ? window[flashMovieId] : document[flashMovieId];
}
In which the flashMovieId parameter is the identifier of the Flash movie - whether the id attribute in the object tag or the name attribute in the embed tag:
<object CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="550" height="400" id="flashMovieId">
<param name="movie" value="flMovie.swf">
<embed src="flMovie.swf" width="550" height="400" name="flashMovieId">
</embed>
</object>
Getting a reference to the Flash object involves user-agent string detection. Could you please discribe why it is required and whether there is a way to skip over this method of browser detection via user-agent string?