Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

New Developer
Posts: 2
Registered: ‎05-08-2011
My Device: playbook
My Carrier: none

can't stop playing sounds

i used:


var sound : Sound = new Sound(new URLRequest('MySound.mp3'));



to play it, then i  use


Sound.close() to stop playing it, but it doesn't work, is there a problem with it? or is there another way to stop the sound? 


version 1.0.1

Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: can't stop playing sounds

hey cljeleven,


welcome to the forums! what you need to do is create a SoundChannel variable to control the sound. when you do sound.play() its actually a reference to a SoundChannel object. From there you can stop and play it. Here's an example:



var sound:Sound = new Sound(new URLRequest('MySound.mp3'));

var soundChannel:SoundChannel = sound.play();



hope that clears things up. good luck!


J. Rab (Blog) (Twitter)
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
New Developer
Posts: 2
Registered: ‎05-08-2011
My Device: playbook
My Carrier: none

Re: can't stop playing sounds

so i still use sound.play() for playing the sound and soundchannel.stop() to stop the sound?

Posts: 102
Registered: ‎01-12-2011
My Device: Blackberry Playbook
My Carrier: DiGi twitter@TylorPin

Re: can't stop playing sounds

btw if the soundchannel is used for other sound, it can not be stopped using the soundchannel.stop() method. Like this: 

var sound1:Sound = new Sound(new URLRequest('Gamebg.mp3'));
var sound2:Sound = new Sound(new URLRequest ('Sound2.mp3'));

var soundChannel:SoundChannel = sound1.play(0,99); //loop the sound indefinately. Useful for game background music.
var soundChannel:SoundChannel = sound2.play();

soundChannel.stop(); //only stops sound2
//this does not stop the first sound1.

 simple workaround would be making seperate soundchannel for background music.


soundChannel2= sound2.play(0,9999);


Click "like" if my reply helps and click "Accept as Solution" if it solves your problem!

twitter @Twopinstudio
my vendor page https://appworld.blackberry.com/webstore/vendor/7126/?lang=en