One method is moving the sprite indirectly.
When you set up the variables to look after the button, set up a "current" value which is used to position the sprite and a "target" value which is used to set the intended position.
I would suggest a UDT for the button something like
Type myButtonType
xpos
ypos
xtarget
ytarget
spriteref
endtype
global myButton as myButtonType
Then each loop, call a function to check if the current value is the same as the target and if not, adjust the current value and move the sprite.
function checkButtonPos()
xdiff = myButton.xTarget - myButton.xpos
ydiff = myButton.yTarget - myButton.ypos
if xdiff <> 0 or ydiff <> 0
mybutton.xpos = mybutton.xpos + (xdiff > 0) - ( xdiff < 0)
mybutton.ypos = mybutton.ypos + (ydiff > 0) - ( ydiff < 0)
setSpritePosition( mybutton.spriteRef , mybutton.xpos, mybutton.ypos )
endif
endfunction
Now if you want to move the button, you put the location you want to move it to into the target fields of the global variable and the button will move (in the example at a rate of 1 pixel per frame).
This is a very, very basic outline but should give you an idea.
It can be enhanced by giving the button a movement speed or perhaps a time.
Often I will also use a field to indicate the positions are the same (by adding an
else to the function), which can be checked by the main program to see if the button has arrived.
edit: typo's and spacing