Livecode Wiki
Advertisement

Moves an object from one location to another.

Built-in Message handler[]

Syntax:

move <object> {[from <startLoc>] to <endLoc> |to <pointList> |rel[ative] <motion>} [in <time>] [without {messages | waiting}]

Examples:

move image "sprite" to the mouseLoc in 30 ticks
move button ID 4 relative 50,50 without waiting
move stack "Overview Palette" from 100,30 to 0,30 without messages
move the mouseControl to the points of graphic "Polygon" in 10 seconds

Use the move command to animate controls or windows by moving them smoothly across the screen.

Use the move...relative form of the move command to move an object in a straight line a certain distance from its current location. Use the move...from startLoc to endLoc form to move an object in a straight line from one location to another, without regard to where the object started. Use the move...to pointList form to move an object along a set of defined points.

If you specify without messages, built-in messages are not delivered during the move.

If you specify without waiting, the current handler continues immediately, and a moveStopped message is sent when the move is completed. Otherwise, the handler pauses until the move is complete. If you issue another move command while a previous move command for the same object is still executing, the previous move command is halted, and the second move command starts up at the object's current location.

To move multiple objects at the same time, set the lockMoves property to true before issuing the move commands. When you set the lockMoves back to false, all the pending moves begin at once.

To easily move an object along a curved path, create a curve graphic using the freehand Curve tool, then use a statement like the following to move the object:

move button "My Button" to the points of graphic "My Curve"


If you like, you can hide the graphic so that the object follows the invisible curve, but its path is not visible on screen.

Parameters:

  • object: Any visible control or open stack reference. (You can specify a cardwith the move command, but moving a card has no effect.)
  • startLoc: An expression that evaluates to a point, a vertical and horizontal distance from the top left of the current stack, separated by a comma. (If the object is a stack, the distance is from the top left of the screen.) The object is shown at the startLoc before the move begins. If no startLoc is specified, the move starts at the object's current location.
  • endLoc: An expression that evaluates to a point.
  • pointList: A return-separated list of destination points. The object is moved to each point in turn during the move.
  • motion: The motion consists of a horizontal number of pixels and a vertical number of pixels, separated by a comma. A positive number moves the object to the left or down; a negative number moves it to the right or up.
  • time: The time specifies a total time for the move to take from start to end,in milliseconds, seconds, or ticks. If you do not specify a time, the speed of the move is determined by the moveSpeed property.

See also: stop moving (command), unlock moves (command), movingControls (function), moveStopped (message), control (object), lockMoves (property), syncRate (property), moveSpeed (property), location (property), points (property), number (property), lowResolutionTimers (property), Intersect

Advertisement