# \[AS2\] - Sound issues

**URL:** <https://forum.kirupa.com/t/as2-sound-issues/262790>\
**Category:** flash\
**Created:** [June 9, 2008, 9:43pm UTC](https://forum.kirupa.com/t/as2-sound-issues/262790 "2008-06-09T21:43:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![switchBack](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@switchBack](https://forum.kirupa.com/u/switchBack)\
**Post date:** [June 9, 2008, 9:43pm UTC](https://forum.kirupa.com/t/as2-sound-issues/262790/1 "2008-06-09T21:43:34Z")

</div>

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):

```auto

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.
