How to remove this delay?
Barry Levine
themacguy at macosx.com
Wed Apr 9 00:40:01 EDT 2003
I've got a line of code in a script that executes when a specific event
occurs:
show image "largeLetter" with visual effect iris open slowly with
sound the filename of player "currentLetter"
It works fine and causes no errors. However, while this particular line
of code is executing, I have a number of image objects moving around on
screen. Each object contains the following code:
on moveMe
if not the uAllowMove of me then exit moveMe
-- uAllowMove is a custom property (true or false)
------
# THIS SETS THE MOVEMENT SPEED
put 3 into tRate
------
# THIS ADDS AN OFFSET VALUE
put 1 into tOffset
------
# THIS SETS THE BOUNDARIES
if right of me > (width of graphic "fieldOfPlay" + 100) then set the
xDir of me to "-"
if left of me < (left of graphic "fieldOfPlay" - 100) then set the
xDir of me to "+"
if bottom of me > bottom of graphic "fieldOfPlay" + 6 then set the
yDir of me to "-"
if top of me < top of graphic "fieldOfPlay" - 100 then set the yDir
of me to "+"
------
# SET NEW LOCATION OF DOT
put item 1 of loc of me into xLoc
put item 2 of loc of me into yLoc
set loc of me to (value(xLoc & the xDir of me & tRate & the xDir of
me & tOffset) & "," & value(yLoc & the yDir of me & tRate))
send "moveMe" && x & "," & y to me in 20 milliseconds
end moveMe
Obviously, the uAllowMove property of each of the moving images is
True. Again, no errors. However, while the "show image..." line of code
is executing, the image objects (six of them at any given time) stop
moving until the visual effect is complete. I'd like to keep everything
moving smoothly. Any ideas? Would a "send" command do this - something
like SEND "SHOW IMAGE... blah, blah"(so that it can occur without
stopping the rest of the handler from executing)? Or does the action
("show image...etc") cause everything else to stop until the code is
complete? If this is the case, would there be any other code that could
be used. My purpose in the visual effect is simply to draw the user's
attention to the appearance of the image (as it has changed from what
it had been prior to the execution of code earlier in the script).
If the "send" command is the answer, would someone show me the proper
syntax using the line of code above?
(BTW - I do not recall the lista who provided the custom property code
but I have his name buried in the Rev eMail folder. You know who you
are - Thank you!)
Any response on-list or off-list would be appreciated.
Regards,
Barry
More information about the use-livecode
mailing list