1 Reply Latest reply on Jan 29, 2012 11:58 PM by simplezeroec

    FLEX4 TextArea preventDefault ineffectiveness

    kahsbnxasxwasx Level 1

      <?xml version="1.0" encoding="utf-8"?>

      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                                 xmlns:s="library://ns.adobe.com/flex/spark"

                                 xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" applicationComplete="application1_applicationCompleteHandler(event)">

              <fx:Script>

                      <![CDATA[

                              import mx.events.FlexEvent;

                             

                              import spark.events.TextOperationEvent;

       

                              protected function application1_applicationCompleteHandler(event:FlexEvent):void

                              {

                                      name_txt.addEventListener(TextEvent.TEXT_INPUT, __nameInputEvent);

                              }

                             

                              /**

                               * 姓名输入事件

                               *

                               */

                              protected function __nameInputEvent(event:TextEvent):void

                              {

                                      trace('a a  ');

                                      event.preventDefault();

                              }

       

                      ]]>

              </fx:Script>

              <fx:Declarations>

                      <!-- 将非可视元素(例如服务、值对象)放在此处 -->

              </fx:Declarations>

              <s:TextInput x="257" y="212" id="name_txt" />

      </s:Application>