image boundaries
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
image boundaries
How would I set a boundary for an image on a stack, such that only the image can be moved within the boundary. Please help me. Thanks.
You need to be more wordy in your question. I can only guess what you actually mean.
To move your image around on your stack with the mouse, put this in your images script:
To move your image around on your stack with the mouse, put this in your images script:
Code: Select all
on mouseDown
grab me
end mouseDown
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
-
- Posts: 179
- Joined: Sat Apr 08, 2006 11:08 pm
- Contact:
Re: image boundaries
Let's say you have a rectangle graphic "tRect" that defines the boundaries,revmeup wrote:How would I set a boundary for an image on a stack, such that only the image can be moved within the boundary. Please help me. Thanks.
something like this in the script of the image should work:
Code: Select all
local sRect
on mouseEnter
put the height of me / 2 into tH
put the width of me / 2 into tW
put the rect of grc "tRect" into sRect
add tW to item 1 of sRect
subtract tW from item 3 of sRect
add tH to item 2 of sRect
subtract tH from item 4 of sRect
end mouseEnter
on mouseMove
if the mouse is down then
if the mouseLoc is within sRect then set the loc of me to the mouseLoc
end if
end mouseMove
Mark