• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 501
  • Last Modified:

little square in TextINput on multi key press

If a textinput has focus and i press ctrl+p i get little square in the text input
any way of stopping this , i presume flash is trying to interrupt the key press and cause it cant figure it out it puts in a generic symbol
0
jockmahon01
Asked:
jockmahon01
  • 3
  • 2
1 Solution
 
jockmahon01Author Commented:
Example
untitled.bmp
0
 
wal_toorCommented:
I think flash is trying to find the character that belongs to the key combination ctrl-p. According to this ascii table the ascii description of ctrl-p is a DATA LINK ESCAPE. Flash problably does'nt know what kind of character this is, and just puts an unknown character.

Is there a reasin why you want to use crtl-p on a focused textfield. (like printing stuff?)

ascii table: http://www.columbia.edu/kermit/ascii.html

greetz,
walter
0
 
jockmahon01Author Commented:
well no, i have a number of textinputs and then a button, at any stage i want the user to be able to press a key combination , such as ctrl+p or something else, and it will do the same as pressing the button. So for example say  the button was add, I would have the "A"  underlined so the user could press ctrl+a and it would be the same as pressing the button.
0
 
wal_toorCommented:
Hello,

Try something like this, run a function in an ontenterframe loop. There you check if a key that was pressed is a ctrl, or shift and then kill the focus on the focussed textfield. I have attached a snippet of actionscript code. Hope this works for you.

greetz,
walter

// get keypress in onenterframe loop
this.onEnterFrame = function() {
	DetectKeys();
};
function DetectKeys() {
	if (Key.isDown(Key.CONTROL)) {
		// remove focus on textfield
		Selection.setFocus(null);
	} else if (Key.isDown(Key.SHIFT)) {
		// remove focus on textfield
		Selection.setFocus(null);
}

Open in new window

0
 
jockmahon01Author Commented:
one solution  that i have found for this is the following

nameSearchInput.restrict = "\u0020-\u007E £";

its setting the character range in hex, plus the £ char as it seams to get left out
this works a treat
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now