Being silly with penguins
Mark Mitchell
cowhead at mac.com
Wed Apr 27 04:52:15 EDT 2016
Sorry, I joined this thread late. I did something like this in 2003, and it worked great, and I used an animated gif for the animation.
Checkout the built-in property ‘the repeatcount’ in the dictionary.
Then, then set the icon of your button to the animated gif (hide the gif somewhere).
Then, the button script is as trivial as
on Mousedown
set the repeatCount of image "runningMan" to -1
—the gif will now run continuously
set the uAllowMove of me to true
—this is only if you want to turn the moving ability of the button to on/off
end MouseDown
on mouseMove x,y
if not the uAllowMove of me then exit mouseMove
set the loc of me to (max(35,min(zaWide,x))),(max(35,min(zaHigh,y)))
—zaWide and zaHigh are the width and height of the stack, keeps the button on the page, so you don’t lose it
end mouseMove
on MouseUp
set the uAllowMove of me to empty
set the repeatCount of image "runningMan" to 0
—this stops the animation
do other stuff
— e.g. check to see if they have moved the button to the right place
end Mouseup
This worked very well (totally smooth dragging and animation) on the processors available in 2003.
I just checked it again on LC 7.1, and it still seems to work fine.
Hope that helps!
Best,
Mark Mitchell
More information about the use-livecode
mailing list