检测Flash文件何时以Javascript完成播放 [英] Detecting when a Flash file has finished playing in Javascript

查看:127
本文介绍了检测Flash文件何时以Javascript完成播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



有没有一种方法可以做到这一点平原的Javascript?或者它会需要一个回调类型函数被添加到Flash文件本身?



我该如何编码? 。b。
$ b

Javascript:

  jQuery('body') .append('< embed id =flashIntrowidth =100%height =100%type =application / x-shockwave-flashsrc ='+ flashIntro +'pluginspage =http:/ /www.adobe.com/go/getflashplayer/ \>'); 


解决方案

播放。你可以在javascript中设置一个定时器来删除它,如果swf会一直播放一段时间,或者在flash中添加一个外部接口来发送一个JS调用。

在swf的最后一帧或者你的销毁函数中添加这个:


import flash。 external.ExternalInterface;
if(ExternalInterface.available)
ExternalInterface.call(JavaScriptFunctionNameToCallWhenDone,true);


I'm using Javascript to embed a flash file into a website which I then need to remove once it's completed playing.

Is there a way to do this in plain Javascript? Or will it require a callback type function to be added into the Flash file itself?

How do I code this? ._.

Javascript:

jQuery('body').append('<embed id="flashIntro" width="100%" height="100%" type="application/x-shockwave-flash" src="' + flashIntro + '" pluginspage="http://www.adobe.com/go/getflashplayer" /\>');

解决方案

Javascript has no native way to know when Flash is done playing. You can set a timer in javascript to remove it if the swf will always play for a set time or add an External Interface in flash to send a call to JS when its finished playing.

Add this in the last frame of the swf or in your destroy function:
import flash.external.ExternalInterface; if (ExternalInterface.available) ExternalInterface.call("JavaScriptFunctionNameToCallWhenDone", true);

这篇关于检测Flash文件何时以Javascript完成播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆