Hello:
I have made a behavior with a countdown timer. It works. But the problem is when I use it with two or more textbox the counter don't stop and begin to count at the same time. I need to stop the previous timer when you click over another timer (textbox). This is my code. Thank you very much:
property Waiting
property Working
property pNombre
global Seg
on getPropertyDescriptionList
-- create an empty property list called pList
set pList = [:]
addProp pList, #Waiting, [#comment : "How much wait", #format :#integer,default:0]
addProp pList, #pNombre, [#comment : "Member", #format :#string ,default:""]
return pList
end
on BeginSprite me
Working = False
pNombre=sprite(me.SpriteNum).member.name
member(pNombre).text="" & Waiting
end
on exitFrame me
If Working then
if Waiting-Seg <=0 then
Working=false
Seg=0
-- put "the End" && Waiting+Seg
else
--Counting waiting
Seg=the timer/60
member(pNombre).text=""& Waiting-Seg
end if
end if
go to the frame
end
On MouseDown me
starttimer
member(pNombre).text="" & Waiting
Seg=(the timer/60)-- Waiting
Working=True
end
All you need to do is send a message to the other sprites to stop counting using "sendAllSprites()".
On MouseDown me
sendAllSprites(#stop) -- ****** Add this line to your handler. ******
starttimer
member(pNombre).text="" & Waiting
Seg=(the timer/60)-- Waiting
Working=True
end
on stop me -- **** Add this handler *****
Working = false
end stop
North America
Europe, Middle East and Africa
Asia Pacific