[F8/AS2] Working with sound

I have been having trouble while working with sound.
I have an audio clip which i have cut into 4 sections.
(intro, intro-loop, main, main loop.)
I wish to play the first section then loop the second section until a value returns true.
When the value returns true, i want the third section to play after the second has finished its current loop. After the third has played I want the final section to loop forever.

I have tried to do this many ways, via script, putting it all into the time line of a movie clip, but no matter what I try i always get either a gap between the sections or no sound at all.

It may sound like a weird thing to want to do with audio, but I want the second section to loop (after the intro) until the user has clicked the “Enter Site” button, with no gaps or jumps. Then once a variable gets set to true then I want to continue playing into the main part of the music, but i don’t know how.

I haven’t had much experience with sound, can anyone help me?

Regards,