From: mikem75 on
Hello - I'm attempting to use the Flash Text Input component, but can't figure
out how to get the text input! I see in the help files there's a event called
"TextInput.enter" which is triggered when the user hits the enter key, but
can't figure out how to work that event. I've been trying:

on TextInput.trigger me
put TextInput.text
end

but that just gets me an error message on the TextInput.trigger item. I'm
sure this is simple, but I just can't figure it out. Any help?

Mike M

Director 11, Windows Vista Ultimate


From: Sean Wilson on
> Hello - I'm attempting to use the Flash Text Input component, but can't figure
> out how to get the text input! I see in the help files there's a event called
> "TextInput.enter" which is triggered when the user hits the enter key, but
> can't figure out how to work that event. I've been trying:
>
> on TextInput.trigger me
> put TextInput.text
> end
>
> but that just gets me an error message on the TextInput.trigger item. I'm
> sure this is simple

It's /not/ simple - dealing with Flash Components rarely is! ;-)
The component is designed to broadcast an event named #enter when the
user presses the ENTER key, and an event named #change when the text
changes. In order to catch this event, one would usually attach a
behavior to the sprite with a handler name the same as the event name,
but in the case of 'enter' it's a reserved word and the script won't
compile:
-- behavior attached to TextInput component:
on change me
put sprite(me.spriteNum).text
end

--on enter me
-- put sprite(me.spriteNum).text
--end

My recommendation would be to use a regular #text member since you can
trap the ENTER key in a keyDown handler, but it depends on what you're
trying to achieve.
From: mikem75 on
Thanks Sean - I think I get it now.

Its unfortunate these components are so incredibly undocumented and clunky to
use. At first glance they look like such elegant solutions.

I think I'll stick to the tried-and-true regular text member as you suggest.

Cheers!

Mike M
Director 11, Windows Vista Ultimate