package{ import flash.display.Sprite; import flash.text.TextField; import flash.events.FocusEvent; public class Main extends Sprite { public function Main() { var tf1:TextField = new TextField(); tf1.type = "input"; tf1.height = 20; tf1.width = 100; tf1.border = true; addChild(tf1); tf1.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, checkFocus); var tf2:TextField = new TextField(); tf2.type = "input"; tf2.height = 20; tf2.width = 100; tf2.border = true; addChild(tf2); tf2.x = 200; } private function checkFocus(focusEvent:FocusEvent):void { if ((focusEvent.target as TextField).text == "") { focusEvent.preventDefault(); } } }}
Name (required)
email (will not be published) (required)
Website