• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

dispatchEvent to send keyboard events (AS3)?

New Here ,
Mar 19, 2010 Mar 19, 2010

Copy link to clipboard

Copied

Hello,

I am trying to create an on-screen keyboard for a touch-screen kiosk. Does anyone know how to send a keyboard event to a text input component from a button click event? For example, the user will push the on-screen buttons to enter their name, press tab to go to the next field, and so on.

I believe that I somehow need to use dispatchEvent but have not been able to get it to work. For example, pressing the on-screen A keyboard button will fire a CLICK event and call a handler to place an A in the currently focused text input component. The handler needs to be able to dispatch a keyboard event (with the correct keycode) to that text input field and that is where I am stuck.

Is this possible or am I on the wrong track?

Thank you in advance for any help or ideas.

TOPICS
ActionScript

Views

6.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 19, 2010 Mar 19, 2010

Copy link to clipboard

Copied

You cannot force mouse or keyboard events - they HAVE TO come from mouse or keyboard.

In your case, since touch screen invokes MouseEvent - you, perhaps need to write your own code that will fire events from keyboard UI (not keyboard itself) and detect what "key" was clicked. It is similar to regular button functionality.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 15, 2010 Apr 15, 2010

Copy link to clipboard

Copied

Are you positive that it is impossible to emulate a keyboard press?

'Cause I'm facing a quite difficult situation. I must read the mouse movement in X. Depending if X is positive or negative, it should dispatch and event saying that the left or right arrow have been pressed. Ain't there no other way to fake a key press?

Thank you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 15, 2010 Apr 15, 2010

Copy link to clipboard

Copied

you can create and dispatch any event using actionscript.  you'll just need to assign appropriate event properties if you expect to use those properties in a listener function.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 15, 2010 Apr 15, 2010

Copy link to clipboard

Copied

I actually just managed to make a simple script todo what I wanted. I little try&error, but it turned out allright:D

But thanks for the answer kglad.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 15, 2010 Apr 15, 2010

Copy link to clipboard

Copied

you're welcome.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 10, 2012 Apr 10, 2012

Copy link to clipboard

Copied

LATEST

That's not true. I simulate Mouse Events via other function all of the time!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines