Action Script
Код
import flash.external.*;
function lightCellsAvailable(stepSize) {
//... some code
}
var isAvailable:Boolean = ExternalInterface.available;
if (isAvailable) {
// Make function lightCellsAvailable available to Javascript
_root.txtTest.text = ExternalInterface.addCallback("lightCellsAvailable", this, lightCellsAvailable).toString();
}
function lightCellsAvailable(stepSize) {
//... some code
}
var isAvailable:Boolean = ExternalInterface.available;
if (isAvailable) {
// Make function lightCellsAvailable available to Javascript
_root.txtTest.text = ExternalInterface.addCallback("lightCellsAvailable", this, lightCellsAvailable).toString();
}
HTML
Код
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r" />
<title>fight</title>
</head>
<body bgcolor="#006600">
<form>
<input type="button" onclick="callExternalInterface()" value="Call ExternalInterface"/>
</form>
<script>
function callExternalInterface() {
alert(getMovie("fight").lightCellsAvailable);
}
function getMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
}
else {
return document[movieName]
}
}
</script>
<!--url's used in the movie-->
<!--text used in the movie-->
<!-- 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="600" height="269" id="fight" align="middle" VIEWASTEXT>
<param name="allowScriptAccess" value="always" />
<param name="movie" value="fight.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#006600" /><embed src="fight.swf" quality="high" wmode="transparent" bgcolor="#006600" width="600" height="269" name="fight" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r" />
<title>fight</title>
</head>
<body bgcolor="#006600">
<form>
<input type="button" onclick="callExternalInterface()" value="Call ExternalInterface"/>
</form>
<script>
function callExternalInterface() {
alert(getMovie("fight").lightCellsAvailable);
}
function getMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
}
else {
return document[movieName]
}
}
</script>
<!--url's used in the movie-->
<!--text used in the movie-->
<!-- 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="600" height="269" id="fight" align="middle" VIEWASTEXT>
<param name="allowScriptAccess" value="always" />
<param name="movie" value="fight.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#006600" /><embed src="fight.swf" quality="high" wmode="transparent" bgcolor="#006600" width="600" height="269" name="fight" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</body>
</html>
В результате получается что ExternalInterface.addCallback("lightCellsAvailable", this, lightCellsAvailable).toString(); возвращает false...
Помогите разобраться почему???????
