PDA

View Full Version : [AS3] FLV playback wont stop after the page has changed


cduncs
07-02-2009, 09:19 PM
(Flash ActionScript 3)

Hi there,

I'm very new to Flash and i am trying to close a FLVPlayback component from a button in a parenting movieClip

I have been successful in closing the video using a button from the same movieClip that the component resides.

I did this using the following AS:

.................................................. .................................................. ...........


test_btn.addEventListener(MouseEvent.CLICK, test_btnClickHandler);
function test_btnClickHandler(event:MouseEvent):void {
showreel_flv.getVideoPlayer(showreel_flv.activeVid eoPlayerIndex).close();
MovieClip(parent.parent.parent).allPages.gotoAndPl ay("cv");
trace("test_btn Button CLicked");
}


.................................................. .................................................. .........


But i am wanting to use a button that is at least a x3 parent of the component.

This is the hierarchy of my site (all movieClip's):

entireSite>allPages>showreel_page>showreel_video> (the component).

the button i want to use is in:

entireSite>allPages>footer_btns> (the buttons)


if someone could show me how to direct my command to the component, then quite frankly, you would be my hero!


Thank you so much

I'd be very grateful if anyone could even point me in the right direction, and i will help others as much as i can.

DukeW
07-13-2009, 10:02 AM
If I understand your problem is the fact that when you navigate to another page FLV playback doesn't stop. You can solve this by using Event.REMOVED_FROM_STAGE. This way there,s no need to manually tell the layer to stop when ever you navigate to any other page than the one it resides in. Here's a small example of how the event mentioned above should be used:
flVPlaybackInstance.addEventListener(Event.REMOVED _FROM_STAGE, stopPlay);
function stopPlay(e:Event)
{
flVPlaybackInstance.stop();
}

ShakaDula14
01-06-2010, 07:13 AM
If I understand your problem is the fact that when you navigate to another page FLV playback doesn't stop. You can solve this by using Event.REMOVED_FROM_STAGE. This way there,s no need to manually tell the layer to stop when ever you navigate to any other page than the one it resides in. Here's a small example of how the event mentioned above should be used:
flVPlaybackInstance.addEventListener(Event.REMOVED _FROM_STAGE, stopPlay);
function stopPlay(e:Event)
{
flVPlaybackInstance.stop();
}


YYYYEEEEEESSSSS!!!!!

Oh my goodness!

This is EXACTLY what I was looking for!!!!!

I added this string of text in the MC that was native to the video and the video now STOPS playing when I navigate away from the page!!!!

DUKE!

Whoever you are, you are my HERO!!!!!

~does happy dance~

nabehan
10-06-2010, 03:56 PM
that actionscript work for me too...

maartenvg
10-03-2011, 11:43 AM
Hey DukeW,

I became a member to thank you for your post :cool:

Thanks. And thanks to all the others willing to share their knowledge to help flash beginners.

MrMikeUTF
11-07-2011, 02:09 PM
Hi Thanks for that useful bit of code that's been bugging me for a while.

Do you know how to acheive the same result when the FLVPlayback is generated by Actionscript?

Basically I have an XML Playlist and the player is created by the AS3 on the loading of the containing movieclip. As it's born without an instance name is it possible for me to assign one?