我知道这个子喷气机根本不是新的,但我会发疯,它根本不起作用。所以我创建了一个“KISS”(Keep It Stupide Simple)样本,看看它是否可能来自原始的SWF,或者只是一个真正的问题......
HTML托管在网站A上(实际上也是Javascript,但最后一个将在网站C上移动),swf托管在网站B上。
这里的swf(来自Adobe,所以它应该工作......):
import flash.external.*;
Security.allowDomain("*");
var methodName:String = "goHome";
var instance:Object = null;
var method:Function = goToAdobe;
var wasSuccessful:Boolean = ExternalInterface.addCallback(methodName, instance, method);
var txtField:TextField = this.createTextField("txtField", this.getNextHighestDepth(), 0, 0, 200, 50);
txtField.border = true;
txtField.text = wasSuccessful.toString();
function goToAdobe() {
txtField.text = "http://www.adobe.com";
getURL("http://www.adobe.com", "_self");
}
stop();
和HTML / Javascript :(从Flash本身生成的HTML,支持FSCommand(所以allowScriptAccess“总是”)和Adobe的javascript也是如此)
<!-- saved from url=(0013)about:internet -->
<!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" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>KISS</title>
</head>
<body bgcolor="#ffffff">
<script language="JavaScript">
<!--
var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
function KISS_DoFSCommand(command, args) {
var KISSObj = isInternetExplorer ? document.all.KISS : document.KISS;
}
// Hook pour Internet Explorer
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
document.write('<script language=\"VBScript\"\>\n');
document.write('On Error Resume Next\n');
document.write('Sub KISS_FSCommand(ByVal command, ByVal args)\n');
document.write(' Call KISS_DoFSCommand(command, args)\n');
document.write('End Sub\n');
document.write('</script\>\n');
}
//-->
</script>
<form>
<input type="button" onclick="callExternalInterface()" value="Call ExternalInterface" />
</form>
<script>
function callExternalInterface() {
thisMovie("KISS").goHome();
}
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
}
else {
return document[movieName]
}
}
</script>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="KISS" width="550" height="400" align="middle">
<param name="allowScriptAccess" value="always" />
<param name="movie" value="http://www.adopsmanager.com/KISS.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="http://www.adopsmanager.com/KISS.swf" quality="high" bgcolor="#ffffff" width="550" height="400" swLiveConnect=true id="KISS" name="KISS" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer_fr" />
</object>
</body>
</html>
谢谢!
答案 0 :(得分:0)
可能是那个
System.allowDomain
不在原始示例中?看起来示例的其余部分是actionscript2代码,这意味着allowDomain调用是:
System.security.allowDomain