Groups | Blog | Home
all groups > flash actionscript > april 2004 >

flash actionscript : Help: dragging along the x axis?


Mark Jenkins
4/9/2004 5:41:49 PM
I've set up a clip to be draggable on press and dropped on release - no
problem.

on (press) {
this.startDrag();
}
on (release) {
stopDrag();
}

How do I confine the drag to just the x axis? I'd like the object to slide
horizontally and keep the same vertical depth.

Thanks in advance for any help.
Ed Massey
4/9/2004 8:05:26 PM

myMovieClip.startDrag(lockCentre,L,T,R,B)
set lockCentre to true if you want the clip to be locked to the mouse
position.
L = left limit (in pixels)
T = top limit
R = .... and so on

so you need to set your top and bottom limits to 0:

on (press) {
this.startDrag(true,-100,0,100,0);
}

this allows you to drag the movieClip +/- 100 pixels from where you started

hth,
Ed Massey

AddThis Social Bookmark Button