swfobject play/pause/stop

霸气de小男生 提交于 2019-12-20 15:32:13

问题


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 ?


回答1:


Finish code:

function Play(){

swfobject.getObjectById('Object').Play();
}

function Pause(){

swfobject.getObjectById('Object').StopPlay();
}

function Stop(){

swfobject.getObjectById('Object').GotoFrame(1);
}


来源:https://stackoverflow.com/questions/18905267/swfobject-play-pause-stop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!