简体   繁体   中英

Flex : data binding to numeric stepper not working

I'm trying to get two way data binding to work with a numeric stepper. It binds from value to display OK, but when I update the GUI the model value is not changed. How can I fix this?

<?xml version="1.0" encoding="utf-8"?>

        [Bindable]
        private var val:Number = 2;

    ]]>
</fx:Script>
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:NumericStepper x="30" y="27" value="{val}"/>
<s:Button x="30" y="58" label="Apply" click="trace(val);"/>

To get two-way binding, you need a different syntax:

<s:NumericStepper x="30" y="27" value="@{val}"/>

Notice the @ sign before the opening brace. Otherwise, it is just one-way

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM