Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

music clip in preloader

Status
Not open for further replies.

Ragol1

Programmer
Oct 25, 2001
315
US
I have a pre loader in my site that loops frame 2 and 3 untill site is loaded.

I have added another layer called music and put a sound clip that is about as long as the loading process, but because the preloader loops the sound clip keeps looping frame 2 and 3.
Once the pre loader is done frame 5 starts the movie at which point I want the sound to stop.

please help

Nick
 
if you are using mx them load the sound with actionscript and dont attach it to a frame. that will stop the looping.

frame 1

mysound = "new Sound()";
mysound.loadSound(" true);
mysound.start();

frame 5

mysound.stop();

give full url to sound if its not in the library
use attachsound if it is in the library
 

So would it be this for a song in library?
frame 1

mysound = "new Sound()";
mysound.attachSound("song";, true);
mysound.start();

frame 5

mysound.stop();
 
mysound = "new Sound()";
mysound.attachSound("song", true);
mysound.start();

there was a typo in my first post...just spotted in when looking at your code.

song remember must be the linkage name of the sound if its coming from the library...otherwise thats it
 
i always play my sound from external files and above is correct for that when from library it may be

mysound.attachSound("song");

true is for steaming from external files and may not be needed from library.....try both...one will be right or maybe both are
 
i will try it.
Im also trying to add a volume control for the sound.

Thanks
 
An additional note...

Although MM says the parameter is optional, ALLWAYS use this in your soundObject definitions... It will keep you out of further trouble in other circumtances!

Thus:

mysound = "new Sound(this)";
mysound.attachSound... Regards,

oldman3.gif


Don't worry, if my reply is wrong, BillWatson will clean it up for me!
 
once its working

mysound.setvolume(50); //half volume takes numbers from 0 to 100......you can control this with buttons or a slider
 
well its just flat not working
I have a layer called Music

Fram 1 is a blank keyframe with an action of


mysound = "new Sound()";
mysound.attachSound("music");
mysound.start();

Frames 2,3,4 are blank frame and frame 5 has

mysound.stop();


My preloader is working and the site loads but no sound.
 
mysound = new Sound(); // no puntuation marks
mysound.attachSound("music");
mysound.start();
 
ok i got it but the mp3 is playing too fast.

?
 
as i said i always load sound from external sources and never have any problems
i cant say whether or not the problem lies with the file being in the library...it seems unlikely....but try it with the original code using loadsound and give the url to the mp3...just place it on your server and dont forget to put true back in the statement as you want it to stream.
 
silly question probably but you did remember to change the path in the above statement to your own site and folder ?
you must have the full path to the file.
all i can think of is that the path is incorrect.
 
Nobody listening to me... Regards,

oldman3.gif


Don't worry, if my reply is wrong, BillWatson will clean it up for me!
 
Bill... When posting code use code - /code between brackets.

just notived that colon crept in again remove it
Code:
mysound = new Sound();
mysound.loadSound("[URL unfurl="true"]http://mysite.com/music.mp3",[/URL] true);
mysound.start();
Regards,

oldman3.gif


Don't worry, if my reply is wrong, BillWatson will clean it up for me!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top