2016-10-13 00:16:48 点击量:13 标签: 收藏本文
通过TextEvent事件监听用户对文本框内容的修改,如删除,剪切,插入或者拷贝等操作,对文本框的每一次修改都会激活textInput事件,可以通过event.preventDefault()取消显示输入的文本
- package {
- import flash.display.Sprite;
- import flash.events.TextEvent;
- import flash.text.TextField;
- import flash.text.TextFieldType;
- public class Sample0414 extends Sprite
- {
- private var lblInfo:TextField;
- public function Sample0414()
- {
- var textBox:TextField = new TextField();
- textBox.type = TextFieldType.INPUT;
- textBox.background = true;
- textBox.width = 200;
- textBox.height = 20;
- textBox.addEventListener(TextEvent.TEXT_INPUT,onTextInput);
- this.addChild(textBox);
- }
- private function onTextInput(event:TextEvent):void
- {
- if(event.text.toLowerCase().indexOf("<script>")>-1)
- {
- event.preventDefault();
- }
- }
- }
- }
我们是一家提供综合软件外包与弱电工程服务的技术公司。
业务涵盖定制软件、管理系统、网站、小程序、APP、系统集成、网络布线、监控安防、门禁、机房建设及长期技术维护。
公司地址:湖北省宜昌市伍家岗区东站二路6号三峡(宜昌)大数据产业园海洋馆二楼A203室