javascript调用Flash中的函数出错,记得以前调用是没问题的.现在都用问题了.
在MyEclipse中报错:
高手们帮忙看下,我是菜鸟.
please help me!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>InteractFlashJS.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">--> </head>
<body>
<script type="text/javascript">
function callJSFunction(string) {
//document.writeln(string + '<br/>');
}
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
} else {
return document[movieName];
}
}
function callFlashFunction() {
var flashplayer = thisMovie('flashPlayer');
flashplayer.flashCallBack();
//document.write(flashplayer); HTMLObjectElement
}
</script>
<br/>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="flashPlayer" width="500" height="400" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,14,0">
<param name="movie" value="../../Flash_Demo/Study/InteractJavaScript/bin-debug/InteractJavaScript.swf">
<param name="quality" value="high">
<embed src="../../Flash_Demo/Study/InteractJavaScript/bin-debug/InteractJavaScript.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>
</object>
<br/>
<button type="button" id="btn1" onclick="callFlashFunction()">调用Flash内部函数</button>
</body>
</html>
在MyEclipse中报错:
高手们帮忙看下,我是菜鸟.
please help me!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>InteractFlashJS.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">--> </head>
<body>
<script type="text/javascript">
function callJSFunction(string) {
//document.writeln(string + '<br/>');
}
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
} else {
return document[movieName];
}
}
function callFlashFunction() {
var flashplayer = thisMovie('flashPlayer');
flashplayer.flashCallBack();
//document.write(flashplayer); HTMLObjectElement
}
</script>
<br/>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="flashPlayer" width="500" height="400" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,14,0">
<param name="movie" value="../../Flash_Demo/Study/InteractJavaScript/bin-debug/InteractJavaScript.swf">
<param name="quality" value="high">
<embed src="../../Flash_Demo/Study/InteractJavaScript/bin-debug/InteractJavaScript.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>
</object>
<br/>
<button type="button" id="btn1" onclick="callFlashFunction()">调用Flash内部函数</button>
</body>
</html>
flashplayer.flashCallBack is not a function-------------------------------------------------
我的
<param name="allowScriptAccess" value="always" />
<param name="movie" value="aa.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent">
<PARAM NAME=FlashVars VALUE="uploadPage=Upload.axd<%=GetFlashVars()%>&completeFunction=UploadComplete()">
<embed src="aa.swf"
FlashVars="uploadPage=Upload.axd<%=GetFlashVars()%>&completeFunction=UploadComplete()"
quality="high" wmode="transparent" width="550" height="100"
id="fileUpload" align="middle" allowScriptAccess="always"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
还是不行哦 。
以前这个例子是可以的。好像是Flash10出现后就不行了。不知道是不是和Flash10有关。
就算是我把代码复制过来,还是不行。错误提示一样.
这个我遇见过!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>InteractFlashJS.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">--> </head>
<body>
<script type="text/javascript">
function callJSFunction(string) {
//document.writeln(string + '<br/>');
}
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
} else {
return document[movieName];
}
}
function callFlashFunction() {
var flashplayer = thisMovie('flashPlayer');
flashplayer.flashCallBack();
//document.write(flashplayer); HTMLObjectElement
}
</script>
<br/>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="flashPlayer" width="500" height="400"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0">
<param name="allowScriptAccess" value="always" />
<param name="movie" value="../../Flash_Demo/Study/InteractJavaScript/bin-debug/InteractJavaScript.swf">
<param name="quality" value="high">
<embed src="../../Flash_Demo/Study/InteractJavaScript/bin-debug/InteractJavaScript.swf"
quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash"
align="middle"
allowScriptAccess="always"
>
</embed>
</object>
<br/>
<button type="button" id="btn1" onclick="callFlashFunction()">调用Flash内部函数</button>
</body>
</html>
SecurityError: Error #2060: 安全沙箱冲突:ExternalInterface 调用者 file:///E:/Web_Demo/InteractFlashJS/InteractJavaScript.swf 不能访问 file:///E:/Web_Demo/InteractFlashJS/InteractFlashJS.html。Flash中的代码:
public function init():void {
flash.system.Security.allowDomain("*");
ExternalInterface.addCallback("flashCallBack", flashCallBack);
}
public function flashCallBack():String {
mx.controls.Alert.show('sssssssssssss');
return 'call flash function succeed.';
}为何还有这个问题呢?我两边都设置了允许访问.