Re: [Flashcoders] preventing control characters from being typed

2010-05-26 Thread Glen Pike
You can set the restrict property to a list of characters - see 
TextField docs.


On 26/05/2010 16:54, Mattheis, Erik (MIN-WSW) wrote:

I need to make a form that can be used without a mouse. I have

private function keyHandler(e:KeyboardEvent):void {
if (e.controlKey) {
 switch (e.keyCode) {
   case SAVE :
   saveCurrentContent();
   break;

etc, which captures a control-s just fine, but it types a box character into 
the textfield. How do I go about preventing this?
_ _ _
Erik Mattheis
Senior Web Developer
Minneapolis
T  952 346 6610
C 612 377 2272

Weber Shandwick
Advocacy starts here.

PRWeek Global Agency Report Card 2009 - Gold Medal Winner
The Holmes Report Global Agency of the Year
PR News Agency of the Year

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


   


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] preventing control characters from being typed

2010-05-26 Thread Henrik Andersson

Mattheis, Erik (MIN-WSW) wrote:

I need to make a form that can be used without a mouse. I have

etc, which captures a control-s just fine, but it types a box character into 
the textfield. How do I go about preventing this?


There is a preventDefault method in the Event class. But I am not sure 
that it is used for this particular event. If it is not, just prevent 
the event from being dispatched to the final object by calling 
stopPropagation before that happens. You may need to use a capturing 
listener for that.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] preventing control characters from being typed

2010-05-26 Thread Mattheis, Erik (MIN-WSW)
Thanks - event.preventDefault() works if I'm listening for KEY_DOWN - had tried 
it before but was listening for KEY_UP.

_ _ _
Erik Mattheis
Senior Web Developer
Minneapolis
T  952 346 6610
C 612 377 2272

Weber Shandwick
Advocacy starts here.

PRWeek Global Agency Report Card 2009 - Gold Medal Winner
The Holmes Report Global Agency of the Year
PR News Agency of the Year


-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com 
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Henrik Andersson
Sent: Wednesday, May 26, 2010 11:02 AM
To: Flash Coders List
Subject: Re: [Flashcoders] preventing control characters from being typed

Mattheis, Erik (MIN-WSW) wrote:
 I need to make a form that can be used without a mouse. I have

 etc, which captures a control-s just fine, but it types a box character 
 into the textfield. How do I go about preventing this?

There is a preventDefault method in the Event class. But I am not sure 
that it is used for this particular event. If it is not, just prevent 
the event from being dispatched to the final object by calling 
stopPropagation before that happens. You may need to use a capturing 
listener for that.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders