I have written a program in which, while condition is true I am calling a function named play() with using (is in touch).

I am calling different audio .ogg files added in music folder and calling from XML. XML is used to tell where and which audio to play.

Now in play() function I have an if condition where, while (sprite1 is touching) play some set of events. There are many events and also wait calls with many other functions (Note all in play() function with using (is in touch)). Everything is working fine but when I am calling audio from the other functions they are not played as planned. Reason I found is (is in touch) is not true now as I have removed my touch from the sprite and still many other events are pending to be called.

I guess this is the issue as when I touch the screen anywhere it calls the audio. But also still there are other functions and events which are after the audio are played. Is this a bug or I am doing wrong or is any other way to do this.