I'm trying to use ExternalInterface.addCallback to allow js to call an as3 method. My code is as follows:
AS:
ExternalInterface.addCallback("sendToActionscript", callFromJavaScript);
function callFromJavaScript():void{
circle_mc.gotoAndStop("finish");
}
JS:
<button type="button" onclick="callToActionscript()">Switch to square</button>
<script type="text/javascript">
function callToActionscript() {
flashController = document.getElementById("jstoactest")
flashController.sendToActionscript();
}
</script>
It's not working. What am I doing wrong?