I need to call function in flash using javascript. For this purpose I use ExternalInterface class(example described in the end of http://help.adobe.com/ru%5FRU/AS3LCR/Flash%5F10.0/flash/external/ExternalInterface.html). But it does not work for me.
swf declared in html page as:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="305" height="270" id="DemoPlayer" align="middle">
I try to call function from flash using javascript as:
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
}
function sendToActionScript(value) {
thisMovie("DemoPlayer").sendToActionScript(value);
}
In flash I has:
ExternalInterface.addCallback("sendToActionScript", receivedFromJavaScript);
In FireFox I have a message "Error calling method on NPObject! [plugin exception: Error in Actionscript. Use a try/catch block to find error.]."
I've already change value of the param allowScriptAccess" to "always", but it doesn't help. May be problem in placing ExternalInterface.addCallback("sendToActionScript", receivedFromJavaScript); - now it is located in "Action-Frame" tab in "Adobe Flash" for *.fla file. (I'm nowise to flash).
Please, help me to find out what is not correct, thanks.