PDA

View Full Version : preloader and sound problem



colag
November 10th, 2003, 04:46 PM
i have a .swf movie which is about 350k and all but 25k is an embedded mp3. but my preloader doesn't work properly in the sense that it only appears once the the mp3 has downloaded. at the moment the preloader reads:

onClipEvent (enterFrame) {
loading = _parent.getBytesLoaded();
total = _parent.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = int(percent);
percentage = per+"%";
loadBar._width = per;
if (percent>99) {
_parent.gotoAndStop(2);
}
}

the mp3 is in a in a variable 'tune' which is in a clip called 'sound' and that clip is in a clip called 'music'. music is found on the root level.
tune = new Sound();
tune.attachSound("myMP3");
tune.start(0,999);

any help will be gratefully received.
thanx

T-O
November 10th, 2003, 05:09 PM
could you ad a fla file?

colag
November 10th, 2003, 05:54 PM
hi,
you can see my .fla the following url:
http://www.audiogroove.co.uk/audio1.0.fla
thanx,
colin

Voetsjoeba
November 11th, 2003, 05:27 AM
The problem is probably your MP3 in the library being exported in first frame. A better solution, definately since it's only 25k, is loading your sound externally instead of placing it in the library. Very simple, just delete the mp3 from your library, place the mp3 file in the same folder as which your swf is in (or will be in), and replace the attachSound line by


tune.loadSound("myMP3.mp3",true)

Where true indicates streaming or not.

carlnunes
February 22nd, 2004, 04:58 AM
This is a great solution if you don't need the mp3 to loop. You cannot loop with loadSound, only with attachSound(from library). I post this only to hopfully help others not to correct or disprove anyone.


Originally posted by Voetsjoeba
The problem is probably your MP3 in the library being exported in first frame. A better solution, definately since it's only 25k, is loading your sound externally instead of placing it in the library. Very simple, just delete the mp3 from your library, place the mp3 file in the same folder as which your swf is in (or will be in), and replace the attachSound line by


tune.loadSound("myMP3.mp3",true)

Where true indicates streaming or not.

Voetsjoeba
February 22nd, 2004, 06:03 AM
Originally posted by carlnunes
This is a great solution if you don't need the mp3 to loop. You cannot loop with loadSound, only with attachSound(from library). I post this only to hopfully help others not to correct or disprove anyone.

I don't know where you got that idea from, but it is possible to loop a sound that has been loaded with loadSound, both for streaming and non-streaming sound:

Streaming:


yourSound = new Sound();
yourSound.loadSound("yoursong.mp3",true);
yourSound.onSoundComplete = yourSound.start;


Non-streaming:


yourSound = new Sound();
yourSound.load("yoursong.mp3",false);
yourSound.start(0,999);

carlnunes
February 23rd, 2004, 01:36 AM
Great! Is this true for externally loaded mp3s too? That is what I was refering to. Any/all comments are welcome.


Originally posted by Voetsjoeba
I don't know where you got that idea from, but it is possible to loop a sound that has been loaded with loadSound, both for streaming and non-streaming sound:

Streaming:


yourSound = new Sound();
yourSound.loadSound("yoursong.mp3",true);
yourSound.onSoundComplete = yourSound.start;


Non-streaming:


yourSound = new Sound();
yourSound.load("yoursong.mp3",false);
yourSound.start(0,999);

Voetsjoeba
February 23rd, 2004, 02:36 AM
Heh, sounds loaded using loadSound are externally loaded. Only if you'd use attachSound, that'd be non-dynamic (from the library).

carlnunes
February 24th, 2004, 04:41 AM
Check me out, non-dynamic (http://megansorel.com/newness/)! Couldn't have done it without you guys and your posts. THANK YOU!
:trout: