s:TextArea禁止回车,cancelable为true但事件的preventDefault无效
<?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">
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<fx:Script>
<![CDATA[
private function textArea_textInput(evt:TextEvent):void {
if (evt.text == String.fromCharCode(13)) {
trace(evt.cancelable);
evt.preventDefault();
}
}
]]>
</fx:Script>
<s:VGroup>
<s:TextArea id="textArea" width="100%" height="100%" textInput="textArea_textInput(event)"/>
</s:VGroup>
</s:Application>
cancelable打印是true,但是文本框中