5 Replies Latest reply on Oct 12, 2012 8:57 AM by Ned Murphy

# StartDrag : understanding parameters (create limits)

Hello,

i have a problem with the "StartDrag" parameters, i want to create some sort of limits but i can't.

here is what i want to do :

the main idea is making a simple slider puzzle like this :

[1][2][3]

[6][5][4]

[7][8][..]

so what i need now, is that only [4] and [8] can be draggable, but also they only can go to the empty square, and then if for example we come with this

[1][2][3]

[6][5][..]

[7][8][4]

only [5] and [3] can be draggable .

so if someone can help about the "StartDrag" i will be very grateful or maybe i can use another thing,

thank you

• ###### 1. Re: StartDrag : understanding parameters (create limits)

What is your problem with the startDrag parameters that keeps you from creating some form of limits?  Have you looked at the startDrag in the help documentation?  80% of the parameters are for that purpose.

• ###### 2. Re: StartDrag : understanding parameters (create limits)

yes i looked but i only understand what "lock" did but "left,top,right and buttom" i don't know what they mean with them,

what's the number suppose to do, for example if i did this

this.startDrag(true,0,0,5,0); it suppose that the movieClip should be able to move only 5 pixel to the right but somehow the movieClip change his cordinate(0 for the x and y ) and the drag become really weird

• ###### 3. Re: StartDrag : understanding parameters (create limits)

The left, top, right, bottom parameters indicate the ranges of values allowable for movement of the object relative to the parent coordinate system.

So if the command involves 0,0,5,0 then that constrains the object to be moved between _x = 0 and _x = 5 horizontally and at _y = 0 with no vertical movement allowed - all with respect to the coordinate system in whichthe object lies.  So if your object is not sitting at _x=0 thru 5 and _y=0, then it will be moved there when you initiate the startDrag.

For what you are doing you want to have the starting points be where the object currently lies, as in... (false, this._x, this._y, this._x+5, this._y)

You might notice I used false in there instead of true.  The lock tries to force the object to lock its registration to the mouse.  For something where you have to restrain the allowable movement you don't want to try to have it forcing itself to align with cursor at the same time... the user is not likely to be clicking on that exact point.  Making it false will make for smoother control since it is not fighting to align to the cursor.

• ###### 4. Re: StartDrag : understanding parameters (create limits)

thank you sir ^_^

• ###### 5. Re: StartDrag : understanding parameters (create limits)

You're welcome