Groups | Blog | Home
all groups > flash (macromedia) > october 2003 >

flash (macromedia) : sound loop problem


Dwayne Epps
10/5/2003 10:58:03 PM
I've encountered a problem with looping a dynamically loading MP3 file. The
sound will not loop when it reaches the end as specified to loop 99 times in
the script:

bgSound = new Sound(this);
bgSound.loadSound("train_to_catch.mp3", true);
bgSound.start(0, 99);

I loaded the sound dynamically rather than using an event sound because of
load time. Is there a way to correct this? Thanks in advance for any help.
-D-

Dwayne Epps
10/5/2003 11:32:01 PM
Thanks urami_
Being a novice to actionscript, would any looping statements work to
load the sound again when the sound clip ends to load it again? Thanks for
the help.


[quoted text, click to view]

tralfaz
10/6/2003 12:53:59 AM
You can use onSoundComplete to restart the streaming music when it
finishes...

s = new Sound();
s.loadSound("sound9.mp3",true);
s.onSoundComplete = function () {
s.loadSound("sound9.mp3",true);
}

You will get a short pause in the sound between each reload.
tf


[quoted text, click to view]

dcc*
10/6/2003 7:08:13 AM
Sound.onSoundComplete

Availability


Flash Player 6.

Usage


mySoundObject.onSoundComplete = callbackFunction



.... for further details see the Flash MX helpfiles. :-)

Daniel

Dwayne Epps
10/6/2003 9:59:49 AM
Thanks for the help! The looping now works great. If I could ask one more
question, is there a way to sync the animation to the start of the streaming
audio. The animation starts just a few seconds before the audio begins, and
I was wondering how I could sync up the animation to become visible and
start at the same time the audio begins playing? Thanks again for the help!
I really appreciate it.
-D-


[quoted text, click to view]

urami_
10/6/2003 12:29:06 PM

[quoted text, click to view]

That's because 'true' make the sound STREAM , stream nature is to play as it buffers and dump
the audio once it's done , just like online video or any other streaming content... You can't loop unless load all over again.




Regards

urami_*



<lsym>

There's no place like 127.0.0.1

urami_
10/6/2003 3:23:52 PM

[quoted text, click to view]

you could just set it back to event , instead of TRUE write FALSE
But take note unlike Stream sound , Event must load entirely in order to play
dcc*
10/7/2003 9:48:03 PM
You can synchronize using the "mySound.position" function.

See Flash MX Help for details.

AddThis Social Bookmark Button