SoundChannel not working with Flash target

In my project I have a line like this:

channel = sound.play();

And it makes my game crash if I run the Flash build. Is there any way to avoid this? I’m just using the channel so I’m able to stop the sound when I want it, so any alternative way to do that would be welcome.

How are you creating the sound?

Also what error do you get?

private var music:Sound = new Sound();
private var musicChannel:SoundChannel;

music = Assets.getMusic(“music”);
musicChannel = music.play(0, 9999);

To be honest I still haven’t figured out how to use the FlashDevelop debugger (I’ve been working with it for less then two weeks)

Maybe you have music = null, that would crash,

are you sure you have an asset named “music”? what does your project.xml looks like?

often assets call look more like this Assets.getMusic("Assets/music/mysong.mp3") (mp3 for flash, ogg for the rest)

1 Like