Use this on a field to require password access to a projector. Paramaters include the correct password, where to go if correct, and the number of allowed attempts.
--Copyright 1999 Chuck Neal
--chuck@mediamacros.com
--If you find this code helpful, send me an e-mail and let me know. :-)
on beginSprite me
tries = 0
currentword = ""
sprite(spriteNum).member.text = ""
sprite(spriteNum).member.editable = true
end
on keyDown me
if tries = void then tries = 0
if the key = return then
dontpassevent
if currentword = password then
go theMarker
else
alert "Incorrect password."
tries = tries + 1
if tries >= totaltries then
alert "Invalid User"
quit
end if
currentword = ""
sprite(spriteNum).member.text = ""
end if
else
dontpassevent
if the keycode = 51 then
if currentword.char.count > 1 then
howMany = (currentword.char.count - 1)
put howmany
currentword = currentword.char[1..howmany]
else
currentword = ""
end if
else
if "1234567890abcdefghijklmnopqrstuvwxyz-. " contains the key then
currentword = currentword & the key
end if
end if
theText = ""
if currentword.char.count > 0 then
repeat with x = 1 to currentword.char.count
thetext = thetext & "*"
end repeat
end if
sprite(spriteNum).member.text = thetext
end if
end
on getPropertyDescriptionList me
p_list = [:]
addProp p_list, #password, [#format : #string, #default : "myPassword", #comment : "The password:"]
addProp p_list, #theMarker, [#format : #marker, #default : #next, #comment : "Where to go if correct:"]
addProp p_list, #totaltries, [#format : #integer, #default : 4, #comment : "Number of tries:"]
return p_list
end
on getBehaviorDescription me
return "Use this on a field to require password access to a projector. Paramaters include the correct password, where to go if correct, and the number of allowed attempts."
end
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA