swfobject播放/暂停/停止 [英] swfobject play/pause/stop
本文介绍了swfobject播放/暂停/停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$ b pre>
< object id =ItemEditAnimationObjectclassid =clsid:D27CDB6E-AE6D-11cf-96B8-444553540000width =580height =370>
< param name =movievalue =./ 6.swf>
<! - [if!IE]> - >
< object id =ItemEditAnimationObjecttype =application / x-shockwave-flashdata =./ 6.swfwidth =580height =370>
< / object>
<! - <![endif] - >
< / object>
< div id =PlayPauseclass =Play>< / div>
< div id =停止>< / div>
Js
函数OnePlay(){
swfobject.getObjectById('Object')。
函数OnePause(){
swfobject.getObjectById('Object')。Pause();
函数OneStop(){
swfobject.getObjectById('Object')。Stop();
Jquery: b
$(#PlayPause)on(click,function(){
if($(this) hasClass(Play)){
$(this).removeClass(Play)。addClass(Pause);
OnePlay();
}
else if ($(this).hasClass(Pause)){
$(this).removeClass(Pause).addClass(Play);
OnePause();
}
}); ();$
$(#Stop)。
当我点击ID为PlayPause的按钮时,swf start。
但是,如果再次点击或者点击ID为stop的按钮,我会在萤火虫中发生错误: swfobject.getObjectById(...)。暂停不是函数 请告诉我错误以及如何正确停止和停止swf对象?
$ b swifobject.getObjectById ...)停止不是函数
b
function Play(){
swfobject.getObjectById('Object')。
函数Pause(){
swfobject.getObjectById('Object')。StopPlay();
函数Stop(){
swfobject.getObjectById('Object')。GotoFrame(1);
}
Good day.
Code:
<object id="ItemEditAnimationObject" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="580" height="370">
<param name="movie" value="./6.swf">
<!--[if !IE]>-->
<object id="ItemEditAnimationObject" type="application/x-shockwave-flash" data="./6.swf" width="580" height="370">
</object>
<!--<![endif]-->
</object>
<div id="PlayPause" class="Play"></div>
<div id="Stop"></div>
Js:
function OnePlay(){
swfobject.getObjectById('Object').Play();
}
function OnePause(){
swfobject.getObjectById('Object').Pause();
}
function OneStop(){
swfobject.getObjectById('Object').Stop();
}
Jquery:
$("#PlayPause").on("click",function(){
if($(this).hasClass("Play")){
$(this).removeClass("Play").addClass("Pause");
OnePlay();
}
else if($(this).hasClass("Pause")){
$(this).removeClass("Pause").addClass("Play");
OnePause();
}
});
$("#Stop").on("click",function(){
OneStop();
});
When i click on button with id "PlayPause" swf start.
But if i click again or click on button with id "stop", i get error in firebug:
swfobject.getObjectById(...).Pause is not a function
swfobject.getObjectById(...).Stop is not a function
Tell me please where error and how aright make pause and stop swf object ?
解决方案
Finish code:
function Play(){
swfobject.getObjectById('Object').Play();
}
function Pause(){
swfobject.getObjectById('Object').StopPlay();
}
function Stop(){
swfobject.getObjectById('Object').GotoFrame(1);
}
这篇关于swfobject播放/暂停/停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文