Groups | Blog | Home
all groups > flash actionscript > may 2004 >

flash actionscript : Sound loads before the preloading animation. Help!


alexgomes
5/28/2004 11:08:28 PM
Hi there!
I'm developing a website with sound objects controled by action script using
new Sound(); attachSound(). I have an animated preload inside a movieclip in
the first frame, but it don't load before the sounds. The screen remains empty
until the sounds are loaded. If I uncheck the option "Export on first frame" in
the linkage dialog box for the sound file in the library, the actionscript
don't calls the sound anymore.

The only thing I want is to have my sounds preloaded in my movie with an
animated preload in the begining. (keeping the method of calling sounds by
action script)
How are you people used to do this?

Thanx a lot every body!

Alex Gomes
kglad
5/29/2004 4:02:32 AM
alexgomes
5/29/2004 4:00:08 PM
Thanks kglad,
But how can I do that? Using which commands? loadMovie()? Targeted in a Movieclip or in a level?

Could you help me out?

Thanks a lot!

kglad
5/29/2004 5:38:53 PM
if your current published movie is main.swf you can make a movie called
preloader that contains your preload animation of loadbar and/or anything else
you want to display during the load process in frame one and contains a blank
2nd frame. in frame 1 you can use the following code:

_root.createEmptyMovieClip("targetMC",1);
targetMC.loadMovie("main.swf";
preloadI=setInterval(preloadF,100);
function preloadF(){
// insert any code here that you need for your preload display such as:
// loadbar._xscale=100*targetMC.getBytesLoaded()/targetMC.getBytesTotal();
// etc

if(targetMC.getBytesLoaded()>0&&targetMC.getBytesLoaded()>=targetMC.getBytesTota
l()){
clearInterval(preloadI);
gotoAndStop(2);
}
}
AddThis Social Bookmark Button