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

Stop loop Sound

Explorer ,
Dec 21, 2016 Dec 21, 2016

Hello users, I'm going through a difficult time trying to stop a loop from an audio, even using the class + stop, the same does not stop.

I've been trying to focus on this for a few hours, and all the attempts have been in vain:

var mySound:ambientSound = new ambientSound();

function good (Event:MouseEvent) : void {

     MySound.play(0, 999); // Loop

}

function bad (Event:MouseEvent) : void {

     MySound.stop();

}

Could someone clarify to me why this occurs, and a solution? Grateful!

TOPICS
ActionScript
446
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
LEGEND ,
Dec 21, 2016 Dec 21, 2016

I am not familiar with the ambientSound class, but you should be using the same variables... case matters...  mySound  is not the same as MySound

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
Explorer ,
Dec 22, 2016 Dec 22, 2016

It was a small mistake at the time of publication. It's mySound, correct.

But the sound does not stop, I already tried mySound.stop ();

MySound.stopAll (); ... Nothing comes up to stop the sound.

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
LEGEND ,
Dec 22, 2016 Dec 22, 2016

Check out the ambientSound class help files if you can find them.  It should explain how to use the class to control sound if it has that ability.

As I said, I am not familiar with that class.  In AS3 in the days when I used it, there were two elements to sound... the Sound and the SoundChannel classes.  If you wanted to stop a sound you did it thru the SoundChannel...

var aSound:Sound = new MySound();

var aChannel:SoundChannel = new SoundChannel();

aChannel.addEventListener(Event.SOUND_COMPLETE, playAgain);

aChannel=aSound.play();    //assign the sound channel to the sound when you make it play

function stopSound(event:MouseEvent):void { // this example used a mouseclick to toggle the sound off

            aChannel.stop();    // you stop the channel

}

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
Explorer ,
Dec 23, 2016 Dec 23, 2016
LATEST

Thanks for the attention but it did not work. Thank you very much.

I'll look for another solution.

Because the audio starts at one frame, and I stop it at another. But the audio does not stop, it resumes over the previous one, the stop function is not working with the "(0, 999") loop.

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