Alternative to Move?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
xfratboy
Posts: 97
Joined: Fri Mar 05, 2010 9:09 pm

Alternative to Move?

Post by xfratboy » Fri Dec 16, 2011 2:52 pm

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!

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Alternative to Move?

Post by bn » Fri Dec 16, 2011 4:55 pm

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

xfratboy
Posts: 97
Joined: Fri Mar 05, 2010 9:09 pm

Re: Alternative to Move?

Post by xfratboy » Fri Dec 16, 2011 5:52 pm

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.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: Alternative to Move?

Post by dunbarx » Fri Dec 16, 2011 6:16 pm

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

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Alternative to Move?

Post by bn » Sat Dec 17, 2011 10:24 am

Hi Xfratboy,

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

Bernd

xfratboy
Posts: 97
Joined: Fri Mar 05, 2010 9:09 pm

Re: Alternative to Move?

Post by xfratboy » Thu Dec 22, 2011 8:30 pm

Very nice! Thanks. You have helped my greatly!

Post Reply