Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Problem with sound playing twice

Community Beginner ,
Jul 09, 2011 Jul 09, 2011

Hello everyone,

This is a bit of a follow up to my previous post, but this is a different problem. Here's what I'm trying to accomplish:

My project has multiple movieclips with animations running from frame 2 to 44 of my main timeline. Frame 45 contains my homepage and is labeled "home". The first frame only exists to redirect visitors to my homepage (with a gotoAndStop("home") , so they don't see the animations right away. My idea is to make a button use gotoAndPlay(2) so it shows the animations. To make it stop at my homepage I use a stop() command on frame 45.

                                                                                                                                                                                                                                  After my previous sound troubles I put my sounds into variables this time and made some soundchannels to control them. I was going to make my sounds start after clicking the button, using timers to make the sounds start at the right time.

Unfortunately when I tried this using only a single sound with/without timer , the sound played like it should but when it got to frame 45 (with the stop() command) it plays my sound for a second time. I wanted to know if there was any way to get rid of this problem because I'm not even sure what's causing it in the first place and scouring the net didn't give me the answers I was looking for..

Here's some of my code:

<CODE>

import flash.events.MouseEvent;
import flash.media.Sound;
import flash.media.SoundChannel;

var sndFooter:footer_sound;
var sndFooterChannel:SoundChannel;
sndFooter=new footer_sound();

rune_btn_center.buttonMode = true;

rune_btn_center.addEventListener(MouseEvent.CLICK,mouse_down_center);
rune_btn_center.addEventListener(MouseEvent.ROLL_OVER,mouse_over);
rune_btn_center.addEventListener(MouseEvent.ROLL_OUT,mouse_out);

function mouse_down_center(event:MouseEvent):void {
rune_btn_center.gotoAndStop("_down");
gotoAndPlay(2);
sndFooterChannel=sndFooter.play();
}

</CODE>

This is not my entire code, but the rest is just my timer function (which seems to work fine) and my other sounds and buttons.

I hope someone can help me with this problem.

TOPICS
ActionScript
4.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 09, 2011 Jul 09, 2011

use movie explorer to search for an errant footer_sound or sndFooter.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 09, 2011 Jul 09, 2011

When I check movie explorer, I don't find any errant sound files (And I turned the option to show audio/video on).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 09, 2011 Jul 09, 2011

you should be searching for actionscript only using each of those terms in two different searches.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 09, 2011 Jul 09, 2011

I did like you said and all it shows is my code in frame 1.

Am I missing something?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 09, 2011 Jul 09, 2011

if that's all your code, you have your sound attached to a timeline or frame 1 plays more than once.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 09, 2011 Jul 09, 2011

That might be the case since I still hear the sound when I comment out the "sndFooterChannel=sndFooter.play();" line on my button.

However I have checked my frames and I can't see any audiolines on them. I guess I'll check my movieclips again.

But I guess there are no problems with my code at least.

Is there an easy way to trace something like this?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 09, 2011 Jul 09, 2011

Never mind, I found it. There was sound hiding in one of the movieclips. Can't believe I missed it earlier.

I thought it was something with the code because I didn't have this problem when I tested before.

Thanks for the help

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 09, 2011 Jul 09, 2011

you can use the trace() function to see if frame 1 is playing more than once but you've already pinpointed an issue that will cause your sound to play twice.  you just need to check which movieclip has that sound attached to its timeline.

there are ways to efficiently find that movieclip by playing only certain main timeline keyframes and see which contains the problematic movieclip.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 09, 2011 Jul 09, 2011

I found it by deleting content from different layers on my timeline (except buttons ofcourse) till I no longer heard the sound. Then I only had to check 3 movieclips and found the sound that somehow got in there.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 09, 2011 Jul 09, 2011
LATEST

great.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines