Mira te pongo un codigo para que veas como mandar llamar funciones de AS con JS y viceversa...
este es el ejemplo con el que me sirvió:
En flash
Código :
import flash.external.*;
ExternalInterface.addCallback("fncallFromJS",this,fncallFromJS);
btnPrueba.addEventListener("click",fnClick);
function fncallFromJS(pTexto:String):Void
{
myColor=new Color(mcBack);
pTexto = "0x"+pTexto;
myColor.setRGB(pTexto);
txtPrueba2.text = pTexto;
}
function fnClick():Void
{
if (ExternalInterface.available)
{
ExternalInterface.call("callFromAS",txtPrueba.text);
}
else
{
txtPrueba.text = "External Interface is not available";
}
}
en HTML
Código :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>pruebaJS</title>
<style name="myStyle" id="myStyle" type="text/CSS">
.myDiv
{
background: #fcf9e2;
border: #000000 dashed 1px;
width: 301px;
height: 201px;
font-family: Verdana, Arial, Times;
color: #262C38;
}
.mySize
{
width: 100px;
height: 22px;
}
</style>
</head>
<body bgcolor="#ffffff">
<script language="JavasScript" type="Text/Javascript">
function getFlashMovieObject(movieName)
{
if (window.document[movieName])
{
return window.document[movieName];
}
if (navigator.appName.indexOf("Microsoft Internet")==-1)
{
if (document.embeds && document.embeds[movieName])
return document.embeds[movieName];
}
else
{
return document.getElementById(movieName);
}
}
function callFromJS(pObject)
{
vStr = pObject.value;
myFlash = getFlashMovieObject("pruebaJS");
myFlash.bgColor = vStr;
myFlash.fncallFromJS(vStr);
}
function callFromAS(pText)
{
vText = "#"+pText;
document.getElementById('divHTML').style.background=vText;
document.getElementById('txtContent2').value=pText;
}
</script>
<!--URL utilizadas en la película-->
<!--Texto utilizado en la película-->
<div class="myDiv" name="divFlash" id="divFlash">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="300" height="200" id="pruebaJS" align="middle">
<param name="allowScriptAccess" value="always" />
<param name="movie" value="pruebaJS.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#fcf9e2" />
<embed src="pruebaJS.swf" quality="high" bgcolor="#fcf9e2" width="300" height="200" name="pruebaJS" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</div>
<div class="myDiv" name="divHTML" id="divHTML">
<form name="frmPrueba" method="get" target="_self" action="_blank">
<br><br>
Entrada<br>
<input type="text" class="mySize" name="txtContent" id="txtContent">
<input type="text" class="mySize" name="txtContent2" id="txtContent2"><br>
<input type="button" class="mySize" name="btnHtml" value="Boton Prueba" onClick="callFromJS(txtContent)">
</form>
</div>
</body>
</html>
Aclaro hice copy/paste pero espero que te sirva... si gustas puedes postear lo que te parezca extraño.
Saludos.