Page 1 of 1

Click to move right

Posted: Sat Nov 28, 2009 1:42 am
by modfox
Hi everyone, I was wondering how, if at all possible can I make an image move towards the right (fluidly) when I click and hold a button?
I want to do this so when I let go it will stop moving towards the right.

Re: Click to move right

Posted: Sat Nov 28, 2009 8:37 am
by malte
The best way to do this is to set up a timer. In your card script (or any other sensible place"

Code: Select all

on mousedown 
  set the flag of me to true
  moveItRight
end mouseDown

on mouseUp
  set the flag of me to false
end mouseUp

on moveItRight
  set the left of img "myImage" to the left of img "myImage" + 10
  if the flag of me then send "moveItRight" to me in 40 millisecs
end moveItRight
This is out of the top of my head, so please watch for typos.

Hth,

Malte