flash 8 sound actionscript
Here is how i control my sound. I do not usually put the sound on the timeline.
Here is what i do.
I import the sound file to the library.
Right click and select linkage.
Give it an id name for actionscript.
I have a button that toggles sound on off using variable playing which is on _level0
Then i put some code like this to control it..
// ————————————– //
stop();
// audio initialise
var job0701Snd:Sound = new Sound(this);
var job0702Snd:Sound = new Sound(this);
var job0703Snd:Sound = new Sound(this);
// audio attach
job0701Snd.attachSound(”job0701″);
job0702Snd.attachSound(”job0702″);
job0703Snd.attachSound(”job0703″);
// audio stop all other sounds that are not on this frame
job0702Snd.stop();
job0703Snd.stop();
// audio start.
// on off button controls if audio is on or off
if(_level0.playing == true){
job0701Snd.start();
}
// —————————————— //
for each frame with sound i turn off all the ones that are not on this frame
and start the one for this frame.. eg..
this code stops sound from either side and starts this frames sound..
// ——————- //
// audio stop either side
job0601Snd.stop();
job0603Snd.stop();
// audio start if on-off button is set
if(_level0.playing == true){
job0602Snd.start();
}
// —————- //

January 25th, 2007 at 9:20 am
[…] or some information about how to control a Sound object in Flash 8 using actionscript: Flash 8 and Sound Actionscript This tutorial also will show you how to […]