在flash中使用函数:flash.external.ExternalInterface.call('messageBox',"login first before play the game,please!"); 来调用asp页面的js函数,firefox浏览器调用正常,ie7报如下错:
try { document.getElementById("").SetReturnValue(__flash__toXML(MY_FUNCTION()) ); } catch (e) { document.getElementById("").SetReturnValue("<undefined/>"); }
所引用id为null,云云。从网上搜索,论坛回帖说原因为: ie7中的flash object,一定要加id,才可以被识别。 我在asp页面flash元素,增加
<object id="flashObject"...>
...
<embed name="flashObject".../>
</object>
后,还是报错。
继续搜索,在
<script type="text/javascript">
AC_FL_RunContent(
'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0',
'width','600',
'height','450',
'src','flash/flash',
'quality','high',
'id', 'flashObject',
'name','flashObject',
'pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash',
'movie','flash/flash' ); //end AC code
</script>
中,增加id、name,解决问题,不再报错误。