Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

keypressed command in director

Status
Not open for further replies.

pjonesz

Programmer
Apr 10, 2001
1
US
I have a question about the lingo command called keypressed. I have written a script that in theory allows more then two keys at a time to be pressed and will put all of the characters for those keys into a box.

If I press multiple keys at one time, for example, the “QWER” all these keys will recognize they were pressed and all the characters will go into the box. However when I try to include the “T” only the “T” and one other key will be recognized. It works fine for four keys that don’t include the “T”. (This problem also happens when I use the “U” and “Y” keys.)

How many keys can keypressed safely handle at one time? Below is the script that I wrote to do this:

on exitFrame me
k="a"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

k="s"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

k="d"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

k="f"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

k="g"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

k="h"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

k="j"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

k="k"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

k="l"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

k="q"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

k="w"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

k="e"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

k="r"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

k="t"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

k="y"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

k="u"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

k="i"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

k="o"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

k="p"
if keypressed(k) then
sprite(1).member.text = sprite(1).member.text & k
end if

go to the frame
end


also is a one line script the clears the text via a standard button

on mouseUp me
sprite(1).member.text = ""

end

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top