PDA

View Full Version : playing a sound when mc reaches a given position



rs2002
April 1st, 2002, 06:27 AM
i made a search but coudnt find any help. I want that a dragable mc plays a sound when it reaches a certain position _y>400.
Here's the code i use, but without any results:
---------------------------------
onClipEvent (mouseUp) {
&nbsp &nbsp &nbsp &nbsp if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp this.stopDrag(true);
&nbsp &nbsp &nbsp &nbsp }
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (this._y>400) {
this.gotoAndStop(som);
&nbsp &nbsp &nbsp &nbsp }
}
---------------------------------
i have a sound at frame label "som"
Any ideas?

ilyaslamasse
April 1st, 2002, 06:55 AM
The label som is INSIDE the movie clip or OUTSIDE ??
pom 0]

rs2002
April 1st, 2002, 08:42 AM
outside

ilyaslamasse
April 1st, 2002, 09:55 AM
Then you should write
if (this._y>400) {
_root.gotoAndStop(som);
}pom 0]

rs2002
April 1st, 2002, 10:33 AM
sorry but doesnt work either...

ilyaslamasse
April 1st, 2002, 11:11 AM
Where is located the sound is the question... In a movie clip ? In the main timeline ??
pom 0]
Or you can send me your fla ilyas.usal@club-internet.fr, but I'd rather you found it by yourself.

rs2002
April 1st, 2002, 11:42 AM
the sound is in a frame in the main timeline

ilyaslamasse
April 1st, 2002, 11:49 AM
OK, stupid of me... _root.gotoAndStop ("som");

hihi, I forgot about those ""
pom 0]

rs2002
April 1st, 2002, 01:04 PM
now it works, with a little flaw: only plays the sound once; if i drag the clip around, it plays the first time that's there, but not anymore...
how can i turn that around?

ilyaslamasse
April 1st, 2002, 01:21 PM
It should work everytime you unclick your mouse (onclipeven mouseup)... Hard to say just like this.

pom 0]

rs2002
April 1st, 2002, 01:56 PM
now it works because i made gotoAndPlay, instead