[AS2] - Sound issues

I’m having a frustrating issue with sound and I have tried everything I can think of, so thats why I’m here seeking help.

The problem is I’m loading a sound and sometimes it will load and sometimes it wont.

Here is the code (I have taken out a lot if irrelevant extra stuff that I’m having the function do):


var my_sound:Sound = new Sound();

my_sound.onLoad = function(success){
    if(success){
        my_sound.start(0, 999);
    }else{
        trace("Error");
    };
};        
    
my_sound.loadSound(main*.attributes.url);//all the XML stuff works fine.

Pretty straight forward code I think. I just cant figure out why it will sometimes call the onLoad function and sometimes wont, it seems random and I have no idea where to even start to find a solution.