[AS3]ExternalInterface.addCallback注册的函数在浏览器中的兼容
ExternalInterface.addCallback注册的函数在浏览器中的兼容性问题
ExternalInterface.addCallback注册的函数在浏览器中的兼容性问题
- package
- {
- import flash.display.MovieClip;
- import flash.external.ExternalInterface;
- import flash.system.System;
- import flash.system.Security;
- import flash.events.Event;
- public class MapMain extends MovieClip
- {
- public function MapMain()
- {
- testTxt.text=String(ExternalInterface.available);
- Security.allowDomain("*");
- Security.allowInsecureDomain("*");
- this.loaderInfo.addEventListener(Event.COMPLETE,onthisswfready);
- try
- {
- ExternalInterface.addCallback("flushTickets",flushTicketsforjs);
- }
- catch(e:SecurityError)
- {
- testTxt.appendText("_"+e.toString());
- }
- }
- private function onthisswfready(evt:Event):void
- {
- this.loaderInfo.removeEventListener(Event.COMPLETE,onthisswfready);
- testTxt.appendText("_ready");
- }
- private function flushTicketsforjs():void
- {
- //由js中触发主动的更新数据
- testTxt.text="数据已经更新了";
- }
- }
- }
- <script type="text/javascript">
- function onclickHandler()
- {
- thisMapMovie("mapff").flushTickets();
- }
- function onstopHandler()
- {
- thisMapMovie("mapff").StopPlay();
- }
- function onplayHandler()
- {
- thisMapMovie("mapff").Play();
- }
- function thisMapMovie(movieName)
- {
- if (window.document[movieName])
- {
- return window.document[movieName];
- }
- if (navigator.appName.indexOf("Microsoft Internet")==-1)
- {
- if (document.embeds && document.embeds[movieName])
- return document.embeds[movieName];
- }
- else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
- {
- return document.getElementByIdx_x_x(movieName);
- }
- }
- </script>
- “<body>
- <input type="button" value="刷新数据" onclick="onclickHandler();" />
- <input type="button" value="停止" onclick="onstopHandler();" />
- <input type="button" value="播放" onclick="onplayHandler();" />
- <div id="flashContent">
- <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" id="mapff" align="middle">
- <param name="movie" value="mapf.swf" />
- <param name="quality" value="high" />
- <param name="bgcolor" value="#ffffff" />
- <param name="play" value="true" />
- <param name="loop" value="true" />
- <param name="wmode" value="window" />
- <param name="scale" value="showall" />
- <param name="menu" value="true" />
- <param name="devicefont" value="false" />
- <param name="salign" value="" />
- <param name="allowScriptAccess" value="always" />
- <param name="swliveconnect" value="true"/>
- <embed play="true" swliveconnect="true" name="mapff" src="mapf.swf" quality="high" bgcolor="#FFFFFF" width="550" height="400" type="application/x-shockwave-flash" swliveconnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"/>
- </object>
- </div>
- </body>
热门文章推荐
- [HLS]做自己的m3u8点播系统使用HTTP Live Streaming(HLS技术)
- [FMS]FMS流媒体服务器配置与使用相关的介绍
- [AS3]什么是M3U8,与HTML5的区别是什么
- AS2.0 让flash自适应全屏,并且不自动缩放
- [AS3]as3.0的sound类常用技巧整理
- [AS3]as3与ByteArray详解、ByteArray介绍、ByteArray用法
- 关于RTMP,RTMPT,RTMPS,RTMPE,RTMPTE协议的介绍
- [JS]分享浏览器弹出窗口不被拦截JS示例
请稍候...