Wednesday, April 21, 2010

AS2 Sound

Frame 1 - make sure sound clip has been id in properties

_root.firstSound=new Sound();
// line 1 creates a sound for the flash file
v = 100;
//line 3 assigns the value 100 to the variable v
//(we will use this as volume)

// good idea to use preloader with any flash file with audio

on btn 1

on (press){
firstSound.stop();
firstSound.attachSound("m1");
firstSound.start();
}

//line 2 stops any playing sound for first sound
//line 3 attaches sound with identifier m1
//(advanced properties of library object)
//line 4 starts sound playing

on stop btn

on (press){
_root.firstSound.stop();
}

//line 2 stops any playing sound for first sound

No comments: