Page 1 of 1

Alternative to Move?

Posted: Fri Dec 16, 2011 2:52 pm
by xfratboy
I'm seeking some simple guidance on "set loc" vs. Move. Currently, I'm trying to figure out how to use the "set loc" with 'Send to' as a replacement to the move command. Currently I'm doing something like this:
move myObject from locationA to locationB in X millisec

How would I essentially do the same as the above statement but using the 'set loc' method. I know it's just a matter of my gray matter between my ears not functioning properly.

Thanks!

Re: Alternative to Move?

Posted: Fri Dec 16, 2011 4:55 pm
by bn
Hi xfratboy,

do you want to have the animation effect of move or do you just want to change the location of an object.

In the former case you would have to calculate intermediate steps from location a to location b to animate the change of location. In the latter you would just say:

Code: Select all

set the loc of control "myControl" to locationB
Why do you want to use set the loc instead of move? Maybe I don't quite get what you want.

KInd regards

Bernd

Re: Alternative to Move?

Posted: Fri Dec 16, 2011 5:52 pm
by xfratboy
I'm sorry for my lack of clarity. Yes, I'm seeking the animation effect of moving from A to B in a specified amount of time. Move is not helpful for this purpose because I'm wanting certain points (or percentage of distances from A to B ) to trigger other events. I don't think move would allow for this.

Re: Alternative to Move?

Posted: Fri Dec 16, 2011 6:16 pm
by dunbarx
I'm sure there is an easier way to do this, but you cannot set a loc "in time".

So try this:

Code: Select all

on mouseUp
   ask "Locate where?"
   put item 1 of it into x
   put item 2 of it into y
   put "set the loc of btn" && quote &  "button2"  & quote && "to" into temp
   send setversion  && "temp,x,y"to me in one second
end mouseUp

on setversion temp,x,y
   put temp && x & "," & y into temp
   do temp
end setversion
Craig Newman

Re: Alternative to Move?

Posted: Sat Dec 17, 2011 10:24 am
by bn
Hi Xfratboy,

I gave it a try, have a look.
moveBySettingLocII.livecode.zip
(3.17 KiB) Downloaded 337 times
Kind regards

Bernd

Re: Alternative to Move?

Posted: Thu Dec 22, 2011 8:30 pm
by xfratboy
Very nice! Thanks. You have helped my greatly!