deletion while moving...
malte.brill at t-online.de
Fri Dec 19 09:56:18 CST 2003
Hi Igor and all,
have you considered changing from move to setting the loc and send in time
I created a teststack. 2 Buttons:
Btn 1 script:
if there is no btn "animbut" then
create btn "animbut"
set the loc of btn "animbut" to the loc of this card
--Just to make sure there is a btn that moves
if the startLoc of btn "animBut" is empty then
set the startloc of btn "animbut" to the loc of btn "animBut"
--Get starting coordinates
put flag *-1 into flag
if flag=empty then put 1 into flag
--you can start/stop animation by clicking this button
--where am I?
put item 1 of the loc of btn "animBut"+direction into theX
put item 2 of the loc of btn "animBut" into theY
--where shall I move?
if theX=item 1 of the startLoc of btn "animbut" then
put 1 into direction
if theX=item 1 of the startLoc of btn "animbut"+300 then
put -1 into direction
set the loc of btn "animBut" to theX,theY
--call me again
if flag=1 then send myMove to me in 50 milliseconds
--50 Milliseconds because we move only 1 pixel each call
--300/15 seconds=20 pixel each second
--=1 pixel every 50 milliseconds
The second button is the delete button:
put -1 into flag
wait 100 milliseconds with messages
--wait for pending myMove messages
delete btn "animBut"
More information about the use-livecode