Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

removeEventListener for sound is working ?

Is this working ?

Can somebody give me an example of a working code?

Thanks

— asked April 21st 2010 by Dan Tamas
  • iphone
  • removeventlistener
  • sound
0 Comments

2 Answers

  • this one removes itself when finished ;)

    var isPlaying = false;
    if (!isPlaying)
    {
      isPlaying = true;
      var sound = Titanium.Media.createSound({url:'yoursound.mp3'});
      endListener = sound.addEventListener('complete', function()
      {
        isPlaying = false;
        sound.removeEventListener('complete',endListener);
        sound.release();
      });
      sound.volume = 1;
      sound.play();
    }
    
    — answered April 21st 2010 by u no
    permalink
    0 Comments
  • I think I understand now where I was doing wrong.
    Thank you.

    — answered April 22nd 2010 by Dan Tamas
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.