keyboard-eventstextinputapache-royale

Apache Royale : How to detect enter key on j:textInput


I have this code :

<j:TextInput localId="ti_pass"  >
    <j:beads><j:PasswordInput/></j:beads>
</j:TextInput>

Unfortunaly looking at https://apache.github.io/royale-docs/component-sets/jewel/textinput I didn't find a bead for KeyDown event. Is there a specific event to listen for it ?

Is there a way to know if enter key has been hit ?

Thanks Regards


Solution

  • I must say that there's a better solution to your problem, but I completely forgot due to focus on keydown. Sorry.

    You have an enter event in TextInput that you can use directly. Example is in Tour De Jewel in TextInputPlayGround.

    private function enterPress(event:Event):void
    {
        trace("enter pressed");
    }
    
    <j:TextInput text="A TextInput" enter="enterPress(event)"/>
    

    HTH

    Carlos