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

Stop sound btn using AS3

Participant ,
Jul 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

This is a pretty easy question.  First, let me say that I am NOT a coder.  The work I do thus far is able to be done quickly and easily with Code Snippets.  However, there is not a snippet for "STOP SOUND" for a button.  The coding for Stopping All Sounds, is not what I need for this project. 

 

Is there such an animal?  Would anyone happen to know where I could get a tutorial on this?  I have searched the web and YouTube, but I only find the tutorials for creating start and stop coding.  

 

The thing is, I created an animated character that talks and blinks, which is all that I need.  The mp3 is streamed and everything works with no problem...until I want to move to the next page BEFORE the puppet stops talking.  As I said, if I use the code snippets stop all sounds, then the puppet on the next frame will not talk.  

 

Any advice? 

Thanks in advance, 

Terri

Views

84

Translate

Translate

Report

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 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

you should be able to stop a sound embedded in a timeline that has its sync property set to stream by stopping the timeline.

Votes

Translate

Translate

Report

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 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

LATEST
 
/* Click to Play/Stop Sound
Clicking on the symbol instance plays the specified sound.
Clicking on the symbol instance a second time stops the sound.
 
Instructions:
1. Replace "http://www.helpexamples.com/flash/sound/song1.mp3" below with the desired URL address of your sound file. Keep the quotation marks ("").
*/
 
movieClip_1.addEventListener(MouseEvent.CLICK, fl_ClickToPlayStopSound);
 
var fl_SC:SoundChannel;
 
//This variable keeps track of whether you want to play or stop the sound
var fl_ToPlay:Boolean = true;
 
function fl_ClickToPlayStopSound(evt:MouseEvent):void
{
if(fl_ToPlay)
{
var s:Sound = new Sound(new URLRequest("http://www.helpexamples.com/flash/sound/song1.mp3"));
fl_SC = s.play();
}
else
{
fl_SC.stop();
}
fl_ToPlay = !fl_ToPlay;
}

Votes

Translate

Translate

Report

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