0

I'm currently working on visual novel project and facing some problem when using SoundChannel. I've search the similar question here and other web but no result, so I'm ended up here.

The problem occur when I need to play .mp3 on Frame 15 Scene 2. It's just play for a sec, then stops. When I go to the next frame, it does the same thing again (play for a sec then stop) and keep repeating.

But it worked flawlessly when I put the code on Frame 1 Scene 2.

Here's the line on Frame 15 Scene 2

channelmusik1 = musik2.play();

and on the Scene 1, I put this

var musik2:BGM2 = new BGM2();
var channelmusik1:SoundChannel = new SoundChannel();

tried to change .mp3 file, move it to separate layer but no result.

Sunil
  • 3,404
  • 10
  • 23
  • 31
Angsul
  • 1
  • Don't you want to add the MP3s file directly to your frames? writing codes in frames cant bring you any thing more – MESepehr Mar 22 '18 at 07:52
  • @MESepehr No, I want to use linkage to embed the `.mp3` audio instead dragging it to timeline. So I can use the SoundTransform to control the volume – Angsul Mar 22 '18 at 08:55
  • 2
    Whatever you do there, **new SoundChannel** creates an empty instance and generally does not mean anything. The only way to play a sound is via **Sound.play(...)** method, which produces a valid instance of **SoundChannel**. It also might be that as soon as you reassign the current **channelmusik1** variable with something else, the Garbage Collector eats the previous instance of **SoundChannel** and destroys it, resulting in that sound to stop playing. – Organis Mar 22 '18 at 17:44

0 Answers0