hi!
what I'd like to do is create an ad in Flash that would update it's text
dynamically, depending on the page it is viewed in. the text is dealt with in
an admin area, with php and mysql. this I know works well.

The dilemma came in when I tried to find ways to communicate between embedded
swfs and html (with php). I know I can call a loadVariables function and load a
php file that would return the necessary text, but I tried to find other, more
rapid ways of doing this (in order to avoid the dummy page displayed until the
text loads).

Thus I came upon ExternalInterface API. It seemed like a good idea: with php I
could pass the text to appear on the ad to Javascript, and it could communicate
with flash without wasting time with another server call. It seemed swell, but
I hit an annoying error: I actually copied the example in the help files, but
the call to ExternalInterface.addCallback returns false, for some unknown
reason. That only happens inside a browser (IE, Opera, Mozilla and Firefox),
but returns true when I check the swf from flash.

Can anyone help? Or, better, suggest another way of dealing with the problem?
What I want to do is pass some text from the HTML page to Flash, avoiding an
extra server request.

Thank you!

For reference, here's the code in Flash and the one in HTML:


import flash.external.*;

var methodName:String = "goHome";
var instance:Object = null;
var method:Function = goToMacromedia;
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 goToMacromedia() {
txtField.text = "http://www.macromedia.com";
getURL("http://www.macromedia.com", "_self");
}


HTML CODE:

<form>
<input type="button" onClick="callExternalInterface()" value="Call
ExternalInterface" />
</form>
<script language="javascript" type="text/javascript">
function callExternalInterface() {
thisMovie("callback").goHome();
}

function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
}
else {
return document[movieName]
}
}
</script>

<!-- saved from url=(0013)about:internet -->
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#
version=8,0,0,0" width="550" height="400" id="callback" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="callback.swf" /><param name="quality" value="high"
/><param name="bgcolor" value="#ffffff" /><embed src="callback.swf"
quality="high" bgcolor="#ffffff" width="550" height="400" name="callback"
align="middle" allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>