Hi all,
I have a group of objects, and I want to move this group along the horizontal axis. At the same time, I also want an object that is in the group to move along the vertical axis whilst still moving with the rest of the group.
I know of a more complicated way that involves calculating where the object will be on the x and y axis once the move has finished, but I am hoping that there is an easier way.
Any ideas?
Thanks,
Andrew
Move a group in whilst moving an object in the group
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 184
- Joined: Wed Apr 10, 2013 5:09 pm
Re: Move a group in whilst moving an object in the group
Code: Select all
on scrollGroup
set the lockLoc of group "YourGroup" to true
set the left of group "YourGroup" to (the left of this card - 1)
set the left of btn "YourObject" to (the left of group "YourGroup)
send "scrollGroup" to me in 25 milliseconds
end scrollGroup
Code: Select all
on scrollGroup
set the lockLoc of group "YourGroup" to true
set the lockLoc of group "YourGroup2" to true
set the left of group "YourGroup" to (the left of group "YourGroup2"- 1)
set the left of btn "YourObject" to (the left of group "YourGroup)
send "scrollGroup" to me in 25 milliseconds
end scrollGroup
Knowledge is meant to be shared.
Re: Move a group in whilst moving an object in the group
Hi.
Not sure whether you are moving under script control. or via the mouse, or whatever. But if under script control, then with several objects grouped, one of which is a button named "b1", put this into the script of another, independent button:
Move the test group to the left side of the card window. Click on the independent button. Does this help? Do you see what the set-up and clean-up lines do?
Craig Newman
Not sure whether you are moving under script control. or via the mouse, or whatever. But if under script control, then with several objects grouped, one of which is a button named "b1", put this into the script of another, independent button:
Code: Select all
on mouseUp
set the startprop of grp 1 to the properties of grp 1
set the startloc of btn 1 to the loc of btn 1
repeat 100
set the left of grp 1 to the left of grp 1 + 1
set the top of btn 1 to the top of btn 1 + 1
wait 2
end repeat
set the properties of grp 1 to the startprop of grp 1
set the loc of btn 1 to the startloc of btn 1
end mouseUp
Craig Newman