문제

How do I determine whether a value set comes from user interaction with the input component, or from binding?

Example:

<s:NumericStepper xmlns=...
                  value="{SomeDataManager.foo}">
<fx:Script>
    override public function set value(newValue:Number):void {
        if (setByUser) {
            super.value = newValue;
        } else {
            // ...
        }
    }
</fx:Script>
</s:NumericStepper>

Using Flex 4.1 if that matters.

도움이 되었습니까?

해결책

listen for the change event. It will solve your problem.

<s:HGroup>
        <s:NumericStepper change="trace('ns change')" value="{ns2.value}" minimum="{ns2.minimum}" maximum="{ns2.maximum}"/>
        <s:NumericStepper minimum="0" maximum="1000" id="ns2" />
    </s:HGroup>

The change event gets fired when an input component's value is changed by user interaction. If some part of your code is changing that component's value, the change event will not get fired.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top