I followed everything here:
http://blog.circlecube.com/wp-content/uploads/2008/02/ActionscriptJavascriptCommunication2.html
and it is working in IE now. However, if I apply it to my own swf
(which works fine in FF), it is not working in IE. I get the error:
Object doesnt support this action.
Here's my HTML code:
<!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>Actionscript Javascript Communication from Circlecube</title>
<script src="swfobject.js" type="text/javascript"> </script>
<script language="javascript" >
function recieveTextFromFlash(t) {
document.getElementById('htmlText').value = t;
}
</script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="400"><h1>From <a href="http://
blog.circlecube.com">CircleCube.Com</a></h1>
<div align="center">Actionscript Javascript
Communication</div>
<form id="form1" name="form1" method="post" action="">
<textarea name="htmlText" id="htmlText" cols="50" rows="15"> </
textarea>
<br />
<input type="button" name="sendToFlash" id="sendToFlash"
value="Send Text To Flash" onclick="getElementById('flash').accessKey
(htmlText.value); document.getElementById('htmlText').value = ''" />
</form>
Return to the post: <br />
<a href="
http://blog.circlecube.com/2008/02/01/actionscript-
javascript-communication/">
http://blog.circlecube.com/2008/02/01/
actionscript-javascript-communication/</a></td>
<td>
<script type="text/javascript">
var flashvars = false;
var params = {};
var attributes = {
id: "flash",
name: "flash"
};
swfobject.embedSWF("PELTactivity.swf", "swf", "450", "450",
"9.0.0","expressInstall.swf", flashvars, params, attributes);
</script>
<div align="left" id="swf">
<!--<embed src="PELTactivity.swf" id="flash" quality="high"
scale="exactfit" width="450" height="450" name="squambido"
align="middle" allowscriptaccess="always" type="application/x-
shockwave-flash" pluginspage="
http://www.macromedia.com/go/
getflashplayer"/>-->
</div></td>
</tr>
</table>
</body>
</html>
I made some changes in the .FLA file too. But it is working in FF
perfectly so I guess the actionscript is not a problem?
import flash.external.*;
var methodName:String = "accessKey";
var instance:Object = null;
var method:Function = recieveTextFromHtml;
var wasSuccessful:Boolean = ExternalInterface.addCallback(methodName,
instance, method);
function recieveTextFromHtml(t) {
if (t=='f3'){
ExternalInterface.call("clue(2)");
gotoAndStop(4);
}
if (t=='enter'){
ExternalInterface.call("check(1)");
}
}
Please super help me... Im really confused with IE, swfobject, and
javascript.