At 11:54 +0000 03/07/2002, tushar suresh joshi wrote:
>I want the user to type in only numbers in a field and if backspace
>or delete key is pressed it should work as normal bakspace and
>delete key works
Probably the easiest thing to do would be to attach this behavior to
the #text or #field sprite in question:
on beginSprite me
-- Set up the sprite on the stage
sprite(me.spriteNum).member.text = ""
sprite(me.spriteNum).member.editable = TRUE
end
on keyDown me
nKey = charToNum ( the key )
-- ASCII 48 = 0
-- ASCII 57 = 9
-- ASCII 8 = backspace
-- ASCII 127 = delete
if ( nKey >= 48 and nKey <= 57 ) or nKey = 8 or nKey = 127 then
-- Let it through
pass
else
BEEP
stopEvent
end if
end
Hope this helps!
--
Warren Ockrassa | http://www.nightwares.com/
Director help | Free files | Sample chapters | Freelance | Consulting
Author | Director 8.5 Shockwave Studio: A Beginner's Guide
Published by Osborne/McGraw-Hill
http://www.osborne.com/indexes/beginners_guides.shtml
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]