The following code, which is pretty straight out of any Adobe example works fine on Flash 10, but when run in Flash 9, the sending connections onStatus
event receives 'error'.
The expected behavior in this example is that the listeningConnection.ready
method is invoked on SWF1.
A demo of this can be seen on http://easyxdm.net/beta/tests/flash.html (single SWF with conditional logic).
UPDATE The culprit was Flash's caching mechanism as we were using a single flash with conditional branching and not two individual swf-files.
Anyone know if there was a restriction lifted, or a bug fixed related to this in Flash 10?
SWF1
public static function main(swfRoot:MovieClip):Void
{
var channelName = "_channel";
var listeningConnection:LocalConnection = new LocalConnection();
listeningConnection.ready = function() {
ExternalInterface.call("console.log", "ready");
};
listeningConnection.allowDomain = function(domain) {
return true;
};
if (listeningConnection.connect(channelName)) {
ExternalInterface.call("console.log","listening on " + receivingChannelName);
} else {
ExternalInterface.call("console.log","could not listen on " + receivingChannelName);
}
}
SWF2
public static function main(swfRoot:MovieClip):Void
{
var channelName = "_channel";
var sendingConnection:LocalConnection = new LocalConnection();
sendingConnection.onStatus = function(infoObject:Object) {
switch (infoObject.level) {
case 'status' :
ExternalInterface.call("console.log", "LocalConnection connected successfully.");
break;
case 'error' :
ExternalInterface.call("console.log", "LocalConnection encountered an error.");
break;
}
};
if (sendingConnection.send(channelName, "ready")) {
ExternalInterface.call("console.log", "called 'ready'");
}else{
ExternalInterface.call("console.log", "error calling 'ready'");
}
}