create the audioplayer as a global variable:
m.audioplayer=createobject("roaudioplayer")
you probably want to do this near the beginning of your program.
You should also probably include checks for roAudioPlayerEvents in all your event loops, and track playlist position and song elapsed time in global variables as well. I don't recommend using a global port if you are new to Brightscript, so you would probably want to assign the global audio player to the port variable you are working with in each function.
- Joel