Hi there, I need help with the action script of stopping sounds in the movie, I tried the function "stopallsounds" but it didn't work??

Dani AI

Generated

was right to call out the name/case issue, but there are several other reasons a stop call may appear to do nothing. Common causes: the FLA is published for a different ActionScript version (AS2 and AS3 use different audio APIs), the audio is placed on the timeline with Sync set to Stream (streamed audio is tied to frames), the button code never actually runs because of scope or placement, or some other script is repeatedly restarting playback.

AS3: prefer controlling the SoundChannel you get from play(), or use the mixer API to stop everything. Example patterns:

import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;

var s:Sound = new Sound(new URLRequest("music.mp3"));
var ch:SoundChannel = s.play();

// later, stop that channel
ch.stop();
import flash.media.SoundMixer;
// stops playback started via AS3 APIs
SoundMixer.stopAll();

Timeline/AS2 notes and practical checks:

  • If the audio clip on the timeline uses Sync = Stream, stopping via script won't reliably halt it—you must stop the timeline or change the sound’s Sync to Event so it becomes script-controllable.
  • If you create/play sounds in code, store the reference returned when you start them and call stop() on that reference.
  • Verify the button handler actually fires (insert a simple trace or toggle a visible property) so you know the stop routine runs.
  • Search for code that may restart playback (onEnterFrame, setInterval, other handlers).

Summary: confirm the ActionScript version, how the sound is started (timeline vs code), and whether the stop routine executes. That will point to the correct fix: use a SoundChannel or the SoundMixer in AS3, stop the timeline or change sync for streamed audio, or stop the specific sound instance in AS2.

Recommended Answers

All 5 Replies

Member Avatar for Member #114696

Its stopAllSounds();

Hey, I've tested stopallsounds();, but it didn't work. why? I don't know...

Member Avatar for Member #114696

See again carefully. There's difference between stopallsounds and stopAllSounds(); .

In flash there are several keywords that may not work just because you didn't used the correct case. Actionscript is case sensitive.

So its stopAllSounds(); .

See again carefully. There's difference between stopallsounds and stopAllSounds(); .

In flash there are several keywords that may not work just because you didn't used the correct case. Actionscript is case sensitive.

So its stopAllSounds(); .

Hi, I'm sure it's a button and it's action is stopallsounds(); . But it doesn't work...:eek:

Member Avatar for Member #114696

try this...copy or write exactly what it is:

on(release)
{
   stopAllSounds();
}

If it doesn't works it might be due to some other script running somewhere else. For that you need to tell whatever you have dont in detail or even give a part of source.

Also write it clearly in your post whether you are using stopallsounds() or stopAllSounds() . That is probably because its case sensitive so BaD, bad, BAD, bAD are different.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.