FORUMS: list search recent posts

FLV audio keeps playing when navigating to different section of page

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
cowcowcowcowcow
Adam Clark
FLV audio keeps playing when navigating to different section of page
on Jan 21, 2009 at 1:20:44 am

So, just like the title says. My FLV videos play just fine, however when I click on any of the navigation buttons to visit another section of my website, the audio keeps on going. There must be some simple AS to stop the audio once a button is clicked. As it is now, the user has to stop the audio manually by clicking the stop button on the FLV playback component. I am using AS3, thanks for viewing and for any input.


Return to posts index

Anthony Sutliff
Re: FLV audio keeps playing when navigating to different section of page
on Feb 28, 2009 at 4:12:08 pm

Adam,
I Had the same problem, took me two weeks to figure out. I found this code on a Blog. Paste this code in your actions layer above each section of your site: in Home, About, Reel, Portfolio etc..You get the idea. It worked for me. You have to paste it in each section on the main timeline, not just the first frame in actions layer. No more hearing my demo reel audio when you click on another section of my site. Good Luck!




import flash.media.SoundMixer;

SoundMixer.stopAll();


Return to posts index

John Taylor
Re: FLV audio keeps playing when navigating to different section of page
on Mar 26, 2009 at 7:32:00 pm

Adam:

I have the same problem and being new to as3, the response wasn't clear to me. I tried adding the snippet that was posted, but no luck. Here's my code for my .swf file:

import fl.video.VideoEvent;

myPoster.addEventListener(MouseEvent.CLICK, playMovie);

function showPosterFrame(event:Event):void {
myPoster.visible = true;
}

function hidePosterFrame(event:Event):void {
myPoster.visible = false;
}

function playMovie(event:MouseEvent):void {
myVideo.play();
}

myVideo.addEventListener(VideoEvent.PLAYING_STATE_ENTERED, hidePosterFrame);
myVideo.addEventListener(VideoEvent.COMPLETE, showPosterFrame);


Any help would be appreciated,
Thanks,



Return to posts index


John Taylor
Re: FLV audio keeps playing when navigating to different section of page
on Mar 26, 2009 at 11:00:51 pm

Sorry, I meant that last post to be addressed to both Adam and Anthony.


Return to posts index

Adam Clark
Re: FLV audio keeps playing when navigating to different section of page
on Apr 3, 2009 at 12:48:32 am

Hi John,

It worked for me. I just plugged in the code....


import flash.media.SoundMixer;

SoundMixer.stopAll();


Just like Anthony says, make sure you place this code in each of the sections of your page (Home, Portfolio, Info etc.) Good luck



Return to posts index

Steve McCrae
Re: FLV audio keeps playing when navigating to different section of page
on Aug 18, 2009 at 5:24:13 pm

Has anyone found a real solution to this, because simply killing the audio isn't going to stop the video download from occurring, which will just slow down the experience for the user?

i've been trying to deal with this for 4 days and it's aggravating. i have an .flv movie on Frame 1 and I don't have it displayed on frame 2. But the sound continues on Frame 2; it refuses to die. The above code works, but I know that isn't the right way to handle it.

Any solutions? Stop actions for the component and instance (I place it in a movie clip so it only exists in frame 1) aren't working either.


Return to posts index


John Taylor
Re: FLV audio keeps playing when navigating to different section of page
on Aug 21, 2009 at 9:04:59 pm

Adam (and Anthony), I just came back to CC after many months. You guys were right on the money;this did the trick. I hope to give back to the flash community as I get better educated. John


Return to posts index

Chad Hardy
Re: FLV audio keeps playing when navigating to different section of page
on Sep 24, 2009 at 3:18:48 pm

What about all the Flash sites out there that have mp3 players in them? The code you give above stops all audio no tjust the audio associated with a video. There has to be a better way to do this.


Return to posts index

Thomas Slee
Re: FLV audio keeps playing when navigating to different section of page
on Mar 8, 2014 at 1:21:36 am

Got it to work in a way I'd would call "the proper way". All you need to do is add a new element (or work out how to get it to work with existing one), convert to symbol, name it's instance e.g. "pause", then click window->code snippets->audio and video->click to pause video. Make sure your 'vid.pause();' is named to your video's instance name, mine was "vid". The put a stop(); before that code then add your navigation script after it. Im not sure how to add the code to an existing element, I tried but only the navigation would work and the pause would not.

I hope this helps anyone with this problem. If it doesn't then this video is what helped me learn this.

My code is:
stop();

/* Click To Pause Video (Requires FLVPlayback component)
Clicking on the symbol instance pauses the video in the specified FLVPlayback component instance.

Instructions:
1. Replace video_instance_name below with the instance name of the FLVPlayback component that you want to pause.
*/

pause.addEventListener(MouseEvent.CLICK, fl_ClickToPauseVideo_4);

function fl_ClickToPauseVideo_4(event:MouseEvent):void
{
// Replace video_instance_name with the instance name of the video component
vid.pause();
}


/* Click to Go to Previous Frame and Stop
Clicking on the specified symbol instance moves the playhead to the previous frame and stops the movie.
*/

pause.addEventListener(MouseEvent.CLICK, fl_ClickToGoToPreviousFrame_2);

function fl_ClickToGoToPreviousFrame_2(event:MouseEvent):void
{
prevFrame();
}


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]