Audio not playing after switching Layouts

0 favourites
  • 3 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Hello! Every time I get stuck with something, I can usually overcome the problem after some attempt, searching in the manual and/or browsing through the forums to see if someone had the same problem before and how it was solved. As none of these options helped me in this case, I will try my last resort with this topic.

    My issue is simple: I have two layouts, menu and stage. Each one plays and loops a different music on the start. When the player goes from the menu to the stage and vice versa, the current music would stop and the new one would start from the corresponding event page. Problem is that the current layout music plays and stops alright when it should, but in the next layout the corrsponding music doesn't play at all. Strangely enough, when switching back to the starting layout, the corresponding music plays. This also happens for both cases: If I start the testplay on "Menu", the "Stage" music don't play. If I start on "Stage", the "Menu" music don't play.

    Running the debug mode it's possible to see that the music supposed to play in fact starts, but it doesn't plays for some reason:

    Left is the music playing on the starting scene, Right is the music "playing" after swithing the layout. It's possible to see that on the right there's a "0s/NaN s", showing that the audio file is playing but not running (?)

    I personally think that the key to the problem origin can be there, but I tried some things and none of them worked. I tried preloading the audio files, playing the audio before switching the scene instead of playing in the beginning, messing with volume... I also created another test project just to test the audio switching, and it worked perfectly.

    Here are the lines controling the starting and ending of the looping music.

    They are basically "At the start of layout, if this is not playing, play it" and "Before switching the layout, stop the music."

    So... does any one knows what can be the problem or the solution? Thank you so much for any help.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm having the same problem. I want to play a music file on start of layout (i only have one layout in the project), and it just won't play. The debug mode reports the same as mentioned above: music file "playing" but not "running". If anyone knows what causes this problem, i'd be most grateful.

  • Can you please post a capx containing that problem?Use the same codes you used for the audio

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)