Firefox browser drops the method in flash to report is not a function errors, but Google ie has no problem
thisMovie () gets the embed tag, and the output is the same as Google. Why do you report an error? ask for advice.
the front-end code is as follows
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN" xml:lang="zh-CN">
<head>
<title>testFC</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css" media="screen">
html, body { height:100%; background-color: -sharpffffff;}
body { margin:0; padding:0; overflow:hidden; }
-sharpflashContent { width:100%; height:100%; }
</style>
</head>
<body>
<input type="button" onclick="callExternal()" value="Call callExternal" />
<input type="button" onclick="setFC()" value="setFC" />
<input type="button" onclick="getFC()" value="getFC" />
<input type="button" onclick="setFCUseObj()" value="setFCUseObj" />
<div id="flashContent">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" id="testFC" align="middle">
<param name="movie" value="testFC.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="-sharpffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="always" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="testFC.swf" width="550" height="400">
<param name="movie" value="testFC.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="-sharpffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="always" />
<embed src="testFC.swf" name="testFC" quality="high" allowScriptAccess="always" swLiveConnect="true" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="550" height="400"></embed>
<!--<![endif]-->
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
</body>
<script type="text/javascript">
function setFC(){
thisMovie().setFC("soctt","m");
}
function setFCUseObj(){
var obj = new Object();
obj.userName="AlecYan";
obj.sex="m";
thisMovie().setFCUserObj(obj);
}
function getFC(){
alert(thisMovie().getFC());
}
//vflash
function GetSwfUrl(v) {alert("ooooo");
alert(v);
}
//flash"my_mv"htmlswfid
function callExternal() {alert("ffff");
thisMovie().flAlert();alert("111");
}
//jsflash
function thisMovie() {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window["testFC"];
}else{
return document["testFC"];
}
}
</script>
</html>
flash code is placed in the testFC.swf file
//ExternalInterface
import flash.external.ExternalInterface;
flash.system.Security.allowDomain("http://localhost");
flash.system.Security.allowDomain("http://127.0.0.1");
//
flash.system.Security.allowDomain("*");
function setFC(userName:String,sex:String){
var FlashCookie:SharedObject = SharedObject.getLocal("testFlashCookie");
FlashCookie.data.userName = userName;
FlashCookie.data.sex = sex;
FlashCookie.flush();
}
function getFC():String{
var FlashCookie:SharedObject = SharedObject.getLocal("testFlashCookie");
return FlashCookie.data.userName;
}
function setFCUserObj(obj:Object){
var FlashCookie:SharedObject = SharedObject.getLocal("testFlashCookie");
FlashCookie.data.userName = obj.userName;
FlashCookie.data.sex = obj.sex;
FlashCookie.flush();
}
//js)flashgetFC(),setFC(),setFCUserObj
ExternalInterface.addCallback("getFC",getFC);
ExternalInterface.addCallback("setFC",setFC);
ExternalInterface.addCallback("setFCUserObj",setFCUserObj);