I'm trying to get javascript to talk to flash, but I haven't been able to get it to work. I've gotten flash to talk to javascript, but not the other way around. It seems as thought flash isn't listening to the javascript, or I'm do开发者_如何学Cing something wrong. Any suggestions?
Part of the AS3 to initially call the js:
ExternalInterface.call("showGal", slastSelectedNumber);
The js i'm trying to use is:
function showGal(dPicture) {
document.getElementById('fullsizegallery').style.display = 'block';
document.getElementById("flashGalleryContent").someFunctionName(dPicture);
}
Part of the AS3 of other flash file I'm trying to talk to:
var connection = ExternalInterface.addCallback("someFunctionName", changePicNumber);
function changePicNumber(newNumber:Number):void {
picNumber = newNumber;
if (jsonLoaded == true) {
loadImageBig(picNumber);
}
}
Make sure you have something like: <param name="allowScriptAccess" value="always" />
in the Flash html embedding.
精彩评论