1 Reply Latest reply on Jul 13, 2017 4:11 AM by Ibarim

    mx numeric stepper disable autoRepeat on buttons

    Ibarim Level 1

      Hi,

      I'm using different controls on my options panel. After each option change I have to update the local sqlite database (application is in Air). Problem is only with NumericStepper control, beacouse when user presses button and holds down mouse the NummericStepper sends change events one after another. After 1 or 2 updates I get an error that sqlstatement.executing is true so I cannot send another sql query.

      On each change event I block the whole application with:

       

      FlexGlobals.topLevelApplication.stage.mouseChildren = false;

      FlexGlobals.topLevelApplication.tabChildren = false;

       

      But when user presses and holds the button in NumericStepper this blockade doesn't work and NumericStepper still sends the change events as long as user has mouse down.

      So I figured out that I need to change autoRepeat property on NumericStepper's buttons. So I created a class to override the createChildren function.

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:NumericStepper xmlns:mx="http://www.adobe.com/2006/mxml">
      <mx:Script>
      <![CDATA[
      override protected function createChildren():void {
           super.createChildren();     
           nextButton.autoRepeat = true;
           prevButton.autoRepeat = true;
      }
      ]]>
      </mx:Script>
      </mx:NumericStepper>
      
      

       

      But I get an error that it cannot find nextButton or prevButton.

      Is there any way to block autoRepeat on these buttons?