package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.events.TextEvent;
[SWF(width=550, height=400)]
public class Main extends Sprite {
public function Main() {
var tf:TextField = new TextField();
addChild(tf);
tf.width = stage.stageWidth;
tf.height = stage.stageWidth;
tf.type = TextFieldType.INPUT;
tf.wordWrap = true;
tf.addEventListener(TextEvent.TEXT_INPUT, onTextFieldTextInput);
}
private function onTextFieldTextInput(event:TextEvent):void {
var tf:TextField = event.target as TextField;
if (tf.text.indexOf(event.text) > -1) {
event.preventDefault();
}
}
}
}
|