0
votes

I'm trying to play a sound (notification sound) in my flash application and I need to play the sound until the user clicks on something else to stop it.

I can play the sound properly but the issue is that it will only play once but i need it to play constantly (a short delay between each play maybe?).

my current code is this:

    var mySound:Sound = new Sound();
    mySound.load(new URLRequest("iphonenoti_cRjTITC7.mp3"));
    mySound.play();

so I thought I can use setInterval(mySound,5000); in my code but this doesn't work which means it doesn't play the sound on the loop!

could someone please advise on this?

Thanks in advance.

1

1 Answers

1
votes

Well, reading the Documentation of setInterval it states that the first parameter should be a function. In your code, you are passing an Object of the type Sound.

So, there are a couple of options, I'll show you the quickest and dirtiest one.

Instead of setInterval(mySound,5000); you write setInterval(mySound.play,5000);