简体   繁体   English

Flex:与数字步进器的数据绑定不起作用

[英]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. 它从值绑定以显示OK,但是当我更新GUI时,模型值未更改。 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 否则,这只是单向的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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