PDA

View Full Version : sound on hit collision like thing


wacko
05-26-2003, 12:20 PM
hello,

i want a sound to play when a user drags an object on the right location.

The name of the sound is good_job.wav and already stands in the library
this is my script:

on (press){
startDrag("",true);
}
on (release){
stopDrag();
if (eval (_root.lepel1._droptarget)== _root.lepel3);
_root.lepel1._x = _root.lepel3._x;
_root.lepel1._y = _root.lepel3._y;
_root.total = _root.total + 100;
}

Thanks already,

spriggan
05-26-2003, 07:32 PM
my suggestion would be to make a movie clip with 2 frames. on the first frame put a stop(); and on the second frame have the sound clip and in the AS part gotoAndStop(1);

then when you want the sound to play just tell the sound movie clip to play the second frame.
soundmovie.gotoAndPlay(2);

farafiro
05-27-2003, 01:29 PM
//on the root
hitSound = new Sound()
hitSound.attachSound("good_job")
//********
on (press){
startDrag("",true);
}
on (release){
stopDrag();
if (_root.lepel1.hitest( _root.lepel3)); //this is more accurate
_root.lepel1._x = _root.lepel3._x;
_root.lepel1._y = _root.lepel3._y;
_root.total = _root.total + 100;
//Sound to start
hitSound.start()
}