2010-12-13 3 views
0

텍스트 컨트롤 옆에 DateChooser 컨트롤이 있고 마우스를 클릭하여 텍스트를 선택하면 마우스 버튼을 계속 누르고 마우스 버튼을 위로 놓으면 날짜 선택기 컨트롤에서 selectedDate 값이 사용자가 가리키고있는 날짜로 변경됩니다. 나는이 문제에 문제가있는 사용자가 있으며 두 컨트롤의 근접성 때문에 실수로 발생합니다. 이 효과를 막을 수있는 방법을 찾을 수 없습니다. 기본적으로 사용자가 실제로 캘린더 컨트롤을 클릭 한 경우에만 selectedDate를 변경해야합니다. mouseDown 또는 클릭하십시오. 이러한 이벤트에서 함수를 호출해도이 동작은 변경되지 않습니다. mouseUpEvent (내가 생각하는)에서 날짜를 변경하지 못하게하는 방법이 필요합니다.Flex 3 DateChooser 컨트롤 - MouseUp 이벤트의 날짜 선택 변경

답변

2

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> 
+0

Brilliant! 고쳐서 뭔가를 배웠습니다. 고맙습니다! – cheetoResearch