Я, кстати, класс поля для вода вещественных чисел писал для своей курсовой. Может кому пригодиться.

Код AS3:
package gui {
import flash.display.Sprite;
import flash.events.TextEvent;
import flash.text.*;
public class DigitField extends Sprite {
private var text:TextField;
public function DigitField(caption:String = null) {
mouseEnabled = false;
text = new TextField();
addChild(text);
text.x = 0;
text.y = 20;
text.defaultTextFormat = new TextFormat("_typewriter", 14);
text.autoSize = TextFieldAutoSize.NONE;
text.width = 100;
text.height = 20;
text.background = true;
text.border = true;
text.type = TextFieldType.INPUT;
text.addEventListener(TextEvent.TEXT_INPUT, onInput);
text.maxChars = 10;
if (caption != null) {
var label:TextField = new TextField();
addChild(label);
label.text = caption;
label.defaultTextFormat = new TextFormat("Tahoma", 12);
label.selectable = false;
label.autoSize = TextFieldAutoSize.LEFT;
}
}
private function onInput(e:TextEvent):void {
var txt:String = e.text;
var str:String = "";
for (var i:int = 0; i < txt.length; i++) {
var char:String = txt.charAt(i);
if (isDigitChar(char) || ((char == "." || char == ",") && (dotIndex(text.text) < 0 || dotIndex(text.selectedText) >= 0) && dotIndex(txt) == i)) {
str += char;
}
}
e.preventDefault();
if (str != "") {
text.replaceSelectedText(str.substr(0, 10 - (text.length - Math.abs(text.selectionEndIndex - text.selectionBeginIndex))));
}
}
private function dotIndex(str:String):int {
var id1:int = str.indexOf(".");
var id2:int = str.indexOf(",");
return (id1 < 0) ? id2 : (id2 < 0) ? id1 : (id1 < id2) ? id1 : id2;
}
public function get value():Number {
var val:Number = Number(text.text.replace(",", "."));
return isNaN(val) ? 0 : val;
}
private static function isDigitChar(char:String):Boolean {
var charCode:Number;
charCode = char.charCodeAt();
return (charCode >= 48 && charCode <= 57);
}
}
}