PDA

View Full Version : Movement Using ActionScript - Stop on an x point?



loopdogg
September 8th, 2005, 09:26 PM
Hi everyone,

I was using this tutorial

http://www.kirupa.com/developer/mx/ASmovement.htm

Which is awesome, but i would like to stop the movement on a certain x point. I'm a real noob and am not sure how to do it.

Could someone please post the script I would need? Thanks!

aldomatic
September 8th, 2005, 09:38 PM
use and if statement

if(moveClip._x == location){
moveClip._x = location;
}

aldo
:)

freeskier89
September 8th, 2005, 10:11 PM
It would be better to do this so it actually stops:
if(_x==stopX){
speed=0;
}
Most likely you will want to use an inequality rather than the == so that if the x or y Exceeds a certain value it stops. Ex if speed=2 and the startX = 0, if you want it to stop when x=5 it won't work. In that case you would use if(_x>stopX);

Hope this isn't too confusing!
-freeskier89