Hi Purplepit-ga,
Luckily, what you require is pretty common, and there's several
solutions to the problem which require no Lingo programming on your
part.
The easiest, but least secure is to use a font that instead of letters
and numbers, just has all asterisks. An example of this is shown at
http://www.lingoworkshop.com/code/widgets_password.asp which also
provides the source code to the Director files downloadable for free.
Why this is insecure is because someone could copy this text into a
word editor, change the font and then they'd know the password.
However, for your application (a user's pin number) I think this would
work out fine.
The next solution would be to use this lingo code which , checks for
RETURN/ENTER pressed, the correct password and replaces text with '*'.
--------------------------
property mytext
property password
property ok
global gpassword
on beginsprite me
ok = 0
gpassword = "password"
password = empty
pevents = empty
mytext = empty
sprite(me.spritenum).visible = 1
sprite(me.spritenum).member.text = empty
end
on exitframe me
if ok <> 1 then
go the frame
end if
end
on prepareframe me
txt = sprite(me.spritenum).member.text
if txt <> mytext then
if txt.char[txt.char.count] = RETURN or txt.char[txt.char.count] =
ENTER then
txt = chars(txt,1,txt.char.count-1)
mytext = txt
sprite(me.spritenum).member.text = mytext
----------------------------------------
-- check for password after RETURN/ENTER
----------------------------------------
if password <> gpassword then
sprite(me.spritenum).member.text = empty
password = empty
mytext = empty
ok = 0
beep
else
ok = 1
go "admin"
end if
else
repeat with i = 1 to txt.char.count
newtxt = newtxt&"*"
end repeat
sprite(me.spritenum).member.text = string(newtxt)
mytext = newtxt
alter me, txt
end if
end if
end
on alter me, txt
password = password&txt.char[txt.char.count]
end
------------------------------
A useful resource, where I obtained the above code, and in discussing
this problem can be found in a discussion thread at Macromedia
Director Forums: http://webforums.macromedia.com/director/messageview.cfm?catid=187&threadid=695116&highlight_key=y&keyword1=password
Search terms used:
director mx lingo password field
I hope this answers your query, it has been a pleasure helping you.
If you require any further assistance please don't hesitate to ask for
a clarification
Sincerely,
andyt-ga |
Request for Answer Clarification by
purplepit-ga
on
31 Oct 2003 15:17 PST
Hi There,
Thanks for your answer so far.....
But I tried copying and pasting the given, code into the script box
associated with the sprite in question, in between "onmouseup
(Handler) and "End".... and it returns a script error saying:
(variable used, before assigned a value, property mytext)
Can you check this for me, If Im doing something wrong. Also I cant
find the downloadable code(section) from the site you suggested!!!
Thanks and regards
purplepit-ga
|