To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > General Help > Games

Reply
 
Thread Tools Display Modes
Old 02-17-2008, 09:50 PM   #1
mr_malee
M.D.
 
mr_malee's Avatar
 
Join Date: Dec 2002
Location: Shelter
Posts: 4,060
[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
mr_malee is offline   Reply With Quote
Old 02-17-2008, 10:49 PM   #2
Flashkit
FK founder & general loiterer
 
Flashkit's Avatar
 
Join Date: Feb 2000
Location: Sydney
Posts: 1,148
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
-------------------------------
markfennell.com | original games | world panoramas
Flashkit is offline   Reply With Quote
Old 02-17-2008, 11:15 PM   #3
mr_malee
M.D.
 
mr_malee's Avatar
 
Join Date: Dec 2002
Location: Shelter
Posts: 4,060
yeah, guess thats the only thing to do.
__________________
lather yourself up with soap - soap arcade
mr_malee is offline   Reply With Quote
Old 02-18-2008, 03:31 AM   #4
tonypa
Moderator
 
tonypa's Avatar
 
Join Date: Jul 2001
Location: Estonia
Posts: 8,193
I have used it for years without problems. Of course I always pick music that has pause in the end.
__________________
My games, Tile based tutorials, Vectors, Latest update - Ununicum
tonypa is offline   Reply With Quote
Old 02-18-2008, 03:50 AM   #5
chriserrorplain
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
__________________
kill5
chriserrorplain is offline   Reply With Quote
Old 02-18-2008, 04:53 AM   #6
charlie_says
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.
__________________
pling
charlie_says is offline   Reply With Quote
Old 02-18-2008, 08:55 AM   #7
MikeMD
Senior Member
 
Join Date: Sep 2004
Posts: 628
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?
__________________
game examples
MikeMD is offline   Reply With Quote
Old 02-18-2008, 10:36 AM   #8
_Ric_
Senior Member
 
Join Date: Jan 2008
Location: UK
Posts: 262
Quote:
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.
_Ric_ is offline   Reply With Quote
Old 02-18-2008, 05:54 PM   #9
mr_malee
M.D.
 
mr_malee's Avatar
 
Join Date: Dec 2002
Location: Shelter
Posts: 4,060
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
mr_malee is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > General Help > Games

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:51 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.