问题
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