A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: [AS3] fix for SoundComplete?

  1. #1
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139

    [AS3] fix for SoundComplete?

    anyone know of a fix for the dreaded Event.SOUND_COMPLETE in AS3?

    looping a sound seamlessly will not work with this event.

    the only other way I could see is using a timer or enterFrame, and figuring out the change in position over the sounds duration, and using that to play the sound again, something like:

    var magicNumber = ?

    var seamlessEnd = sound.duration - magicNumber;

    timer.delay = seamlessEnd;
    lather yourself up with soap - soap arcade

  2. #2
    FK founder & general loiterer Flashkit's Avatar
    Join Date
    Feb 2000
    Location
    Sydney
    Posts
    1,149
    If you are just looping the one loop then why not use the yourMusicTrack.play(0,999, null) to play it 999 times.

    SOUND_COMPLETE sucks
    Regards Mark Fennell - Flash Kit Founder, general loiterer
    -------------------------------
    I Hate Zombies - iPhone Game | markfennell.com

  3. #3
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    yeah, guess thats the only thing to do.
    lather yourself up with soap - soap arcade

  4. #4
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    I have used it for years without problems. Of course I always pick music that has pause in the end.

  5. #5
    Senior Member chriserrorplain's Avatar
    Join Date
    Aug 2002
    Location
    london village
    Posts
    623
    this has always made me sad, being both a coder and a composer of loop based music, I have always dreamed of creating aiMuse style interactive score kind of thingy for flash, allowing parts to come in and out as actions change on screen...but alas with out a seamless onComplete it's impossible.

    Chris Error

  6. #6
    Senior Member charlie_says's Avatar
    Join Date
    Feb 2003
    Location
    UK
    Posts
    508
    Although I've not pushed this into AS3 yet, in earlier versions I actually did my own checks on how far thru the sound clip I was. By doing this I was able to dynamically load the next part seamlessly, or replay the current clip.
    Can't imagine I'll go back to using the sound complete check now.

  7. #7
    Senior Member
    Join Date
    Sep 2004
    Posts
    633
    Sounds like you are just looking for a way to loop one file. Why would you need on sound complete anyway?

    Or maybe I'm off?

  8. #8
    Senior Member
    Join Date
    Jan 2008
    Location
    UK
    Posts
    269
    var magicNumber = ?

    var seamlessEnd = sound.duration - magicNumber;

    timer.delay = seamlessEnd;
    I tried something like this - using the setTimeout function, and finding the 'magic nunmber' by trial and error. I couldn't just loop it as some are suggesting here, as I was trying to join two separate tracks together. It worked, although I wasn't confident that the magic number on my PC would be exactly the same for everyone. Never really found out before I gave up and used a different method altogether.

    Would be very useful to know of a solution to this though.

  9. #9
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    Quote Originally Posted by MikeMD
    Sounds like you are just looking for a way to loop one file. Why would you need on sound complete anyway?

    Or maybe I'm off?
    yeah, Flashkit was right, using the loop parameter works. I had forgot all about it.

    It still is a problem though for multiple tracks/sounds as chris pointed out.
    lather yourself up with soap - soap arcade

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center