Waiting for a handler to finish
Jim Hurley
jhurley at infostations.com
Sat Mar 5 12:54:09 EST 2005
I'm having problems with messages.
I want to have an oval graphic fade out to 0 width and height,
relocate to a new position and then fade in with diamMax width and
height at the new location.
And I want all this to happen while another graphic is moving on the
screen. For this reason, all loops are executed with "send" messages
in xx time.
I have tried the following:
local diamMax
on mouseUp
send "mouseUP" to grc "myGraphic"
--The above command starts "myGraphic" in motion.
--That motion is executed with {"send ..... in 10 millisec" and
--is suppose to continue while the rest of this script is running.
put the width of me into diamMax
--I want the following doFadeOut to complete execution before
"doFadeIn" starts.
doFadeOut diamMax
--The following wait doesn't do what I want.
--It halts everything since the message is received at the
--first execution of doFadeOut.
wait until "doFadeOut" is not in the pendingMessages --What do I
need to do here?
set the loc of me to 200,200
doFadeIn 0
end mouseUP
on doFadeOut r
set the width of me to r
set the height of me to r
if r =0 then exit doFadeOut
send "doFadeOut r-1" to me in 1 tick
end doFadeOut
on doFadeIn r
set the width of me to r
set the height of me to r
if r = diamMax then exit doFadeIn
send "doFadeIn r+1" to me in 1 tick
end doFadeIn
I guess I could insert a wait diamMax ticks (plus something for good
measure). But there must be a way of detecting when doFadOut has
finished and then moving on.
Jim
More information about the use-livecode
mailing list