从flash调用javascript函数

时间:2009-07-30 12:42:25

标签: javascript flash

问候, 我想让我的flash按钮执行一个javascript函数。我已经做了很多搜索并得出结论使用ExternalInterface.call。我也让allowScriptAccess“始终”“但仍然不起作用。 这是我的flash电话:

import flash.external.*;
......................

function rpress() {
    ExternalInterface.call("showMessage");  
}

这就是我将flash文件嵌入到我的html中的方法:(对不起已经很久了)

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>harita</title>
<script language="javascript">AC_FL_RunContent = 0;
function showMessage(){
alert("hey");
}

</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
</head>
<body bgcolor="#18658c">
<!--url's used in the movie-->
<!--text used in the movie-->
<!-- saved from url=(0013)about:internet -->
<script language="javascript">
    if (AC_FL_RunContent == 0) {
        alert("This page requires AC_RunActiveContent.js.");
    } else {
        AC_FL_RunContent(
            'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0',
            'width', '750',
            'height', '420',
            'src', 'harita',
            'quality', 'high',
            'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
            'align', 'middle',
            'play', 'true',
            'loop', 'true',
            'scale', 'showall',
            'wmode', 'window',
            'devicefont', 'false',
            'id', 'harita',
            'bgcolor', '#18658c',
            'name', 'harita',
            'menu', 'true',
            'allowFullScreen', 'false',
            'allowScriptAccess','always',
            'movie', 'harita',
            'salign', ''
            ); //end AC code
    }
</script>
<noscript>
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="750" height="420" id="harita" align="middle">
    <param name="allowScriptAccess" value="always" />
    <param name="allowFullScreen" value="false" />
    <param name="movie" value="harita.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#18658c" />  <embed src="harita.swf" quality="high" bgcolor="#18658c" width="750" height="420" name="harita" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </object>
</noscript>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

尝试更改

'allowScriptAccess','always',

'allowscriptaccess','always',

如果这不起作用,请尝试跳过AC_RunActiveContent.js的使用并使用<noscript>标记中的代码进行测试。有时我看到AC_RunActiveContent在标签上咀嚼