Move a mc if _ymouse is < 50

Hellooo
I want to do this: When the mouse is between two y-coordinates, let’s say 40 and 50, a movieclip is supposed to be moved. How should I do this? I can move the movieclip by clicking on a button but how do I do this one? And where should the code be put? I thought that this code would work if I put it in the first frame, but it’s not…

if (_root._ymouse < 55) {
			   newpos = 100;
			   }

Please help…

Haha… Never mind… I put the code in an empty mc inside a onClipEvent(enterFrame) action and tadaa! =)

you have to make a 2-frame-loop or put the actions on a movieclip within the onClipEvent(enterFrame) handlers!

2-frame-loop:
put the actions in the first frame and make another keyframe in frame 2 and add the action:
gotoAndPlay(1);
on the second keyframe so it will go to the 1st frame, then the 2nd and then the first on again!

or

movieclip:
put the actions on a movieclip like this:

onClipEvent(enterFrame) {
if (_root._ymouse < 55) {
newpos = 100;
}
}

onClipEvent(enterFrame)
enterframe triggers the actions within the handlers every frame! [ so if your fps is 20 the actions will be triggered 20 times per second ]

:slight_smile:

yupp… As I wrote before I did like you said… Thanks anyway for a quick answer!! =)