This is the ultimate snippet in the universe. Use this technique to communicate back and forth between actionscript and javascript. The other files you need are attached to this post, click on the download source files button to get them. Basically this uses the External Interface class to accomplish this task. This is a good example to use to learn and then expand upon the technique.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Javascript - Actionscript Com</title>
<script> function getFlashMovie(movieName) {
var isIE = navigator.appName.indexOf("Microsoft") != -1;
return (isIE) ? window[movieName] : document[movieName];
}
function formSend() {
var text = document.htmlForm.sendField.value;
getFlashMovie("ExternalInterfaceExample").sendTextToFlash(text);
}
function getTextFromFlash(str) {
document.htmlForm.receivedField.value = "From Flash: " + str;
return str + " received";
}
</script>
</head>
<body>
<form name="htmlForm" method="POST" action="javascript:formSend();">
Send to ActionScript:<br />
<input type="text" name="sendField" value="" />
<br />
<input type="submit" value="Send" />
<br />
<br />
Received from ActionScript:<br />
<input type="text" name="receivedField">
</form>
<div style="margin-top:30px;">
<object id="ExternalInterfaceExample" type="application/x-shockwave-flash" data="http://testing.hyperspatial.com/ExternalInterfaceExample.swf" width="550" height="400">
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="swfversion" value="6.0.65.0" />
<param name="expressinstall" value="scripts/expressInstall.swf" />
<param name="movie" value="http://testing.hyperspatial.com/ExternalInterfaceExample.swf" />
</object>
</div>
</body>
</html>

