views:

24

answers:

1

I know this subjet isn't new at all but i'm going to be crazy that it doesn't work at all. So I create a "KISS" (Keep It Stupide Simple) sample just to see if it may be something from the original SWF or just a real problem...

HTML is hosted on web site A (actually the Javascript too, but this last one will be moved on web site C) en the swf is hosted at web site B.

Here the swf (from Adobe so it should work...) :

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();

and the HTML/Javascript : (HTML generated from Flash itself with FSCommand support (so allowScriptAccess is "always") and the javascript from Adobe too)

<!-- 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"&gt;
<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>

Thanks !

A: 

Could it be that

 System.allowDomain

was not in the original example? It looks like the rest of the example is actionscript2 code, that would mean the allowDomain call is:

System.security.allowDomain
Simon Groenewolt