flvplayback component doesn't stop playing upon exitframe

时光总嘲笑我的痴心妄想 提交于 2019-12-25 06:13:38

问题


I have an instance of an flvplayback component on a frame (not the first frame) on a timeline in a flash AS3 flash app file.

I would like to stop the movie when i exit that frame, either via gotoAndStop() or whatever else. Is there a listener for this? Or any solution that people know of?

Thanks, jml


回答1:


You could always add an ENTER_FRAME listener to the parent MovieClip, check if currentFrame yields the correct frame number, and stop the FLV if it doesn't.

But if I understand correctly, the parent MovieClip (the main timeline) isn't playing simultaneously while the FLV plays, but only if some kind of navigation on your page is clicked. If so, you should react directly to the user input.

Try this:

On each button which navigates away from the FLV frame, add this to the click listener:

 stage.dispatchEvent (new Event ("flvLeave"));

In the frame where flvComponent is located (I assume this is the instance name, replace with whatever you called your FLVPlayback component instance), add this:

 stage.addEventListener ("flvLeave", function (ev:Event) : void {
      if (flvComponent != null) flvComponent.stop();
 });


来源:https://stackoverflow.com/questions/5697266/flvplayback-component-doesnt-stop-playing-upon-exitframe

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