Link to home
Create AccountLog in
Avatar of weisianz
weisianz

asked on

disable enter key

mm.. how do i disable the enter function in editable textfield?

i tried using the below script but, the enter key is not disabled

on keydownscript me
if the keycode = 36 then
nothing
end if
end
ASKER CERTIFIED SOLUTION
Avatar of MediaMacros
MediaMacros

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of weisianz
weisianz

ASKER

thanks.. 1 question... how come keycode = 36 does not work while key=return works?
It may if its placed in the script.  You were using on keydownscript which will not register when you type in teh field.  Also note that many keyboards have 2 entere keys with different key codes. :)
i placed another script in the field

on keydown me
if keycode = 36 then
halt
end

when i press enter, the movie is indeed stop.

but, when i change it to

on keydown me
if keycode = 36 then
nothing
end if
end

it's like, all keys disabled... nothing appears in the txtfield... is it cause by the nothing statement?
You need the else.  It needs to be told to pass to allow other keys through.
oh... so, i just have to change it to the following?

on keydown me
if keycode = 36 then
nothing
else
pass
end if
end
Correct. :)

ALso add it for keyUp as well to be safe.  SOme keyboards register the events a bit differently.
oic... ok... thanks