這是一個惱人的錯誤,因爲您無法取消DateChooser上的事件。這裏有一個可能的解決方案:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600">
<mx:Script>
<![CDATA[
private function preventDateChooserBug(e:MouseEvent):void {
//set the mouseChildren property to false, not enabled because
//that could cause an irritating flickering when clicking the
//text input box for focus
dtc.mouseChildren = false;
//add the event listener to stage so we get the mouse up event even
//outside of the text input control
stage.addEventListener(MouseEvent.MOUSE_UP, function(e2:MouseEvent):void {
dtc.mouseChildren = true;
});
}
]]>
</mx:Script>
<mx:TextInput x="10" y="10" id="txt" mouseDown="preventDateChooserBug(event)" />
<mx:DateChooser x="178" y="10" id="dtc" />
</mx:Application>
太棒了!這解決了它,我學到了一些東西。謝謝! – cheetoResearch 2010-12-14 13:52:00