Answer = value(member("answer").text)
for .text property of member: http://help.adobe.com/en_US/Director/11.5/UsingScripting/WSc3ff6d0ea77859461172e0811d64c1a 1b3-7dac.html
In your 2nd example with "B" pressing the ENTER key also adds a(n) (non-displayable) character to the text/field member. However, it's hard to understand what you are trying to accomplish here so I don't know if you want the ENTER key to act like a "Submit" on a web form, for instance, or if you just want to limit the character input to 0-9, for instance.
Thanks for responding to my question.
I want to submit as text what preceded the pressing of the Return key. If I enter a number and press Return it takes that as an action and assigns the number to a variable but for text it interprets the Return key to go to the next line. And as far as I can see nothing is entered.
There is probably a simple solution but if there is I didn't get it.
On the sprite containing the text field you can write a behavior like this:
if (_key.key = RETURN) then Answer = member("Answer").text
There are many ways to do this, but this is at least very simple :-)
Thank you Kari!
I have not had a chnace to try it but your solution should obviously do the job. I appreciate your response.