// Task.
Package
{
Public class task
{
[Bindable]
Public VaR _ name: string;
Public Function task (Name: string)
{
_ Name = Name;
}
}
}
// Mxml
Private VaR _ sum: Int = 0;
[Bindable]
Private var task: task = new task ("FX: script ");
[Bindable]
Public Function get sum (): int
{
Return _ sum;
}
Public Function set sum (value: INT): void
{
_ Sum = value;
}
<S: textinput x = "422" Y = "116" id = "inputone" text = "{task. _ name}">
<S: Label x = "62" Y = "49" width = "137" Height = "27" text = "{sum}" id = "label"/>
The object member must be declared as [Bindable], the object must also be declared as [Bindable], and then bind data.
The getter/setter function can be declared as [Bindable] or bound to Data,
<S: textinput id = "inputone" text = "@ {inputtwo. Text}"/>
<S: textinput id = "inputtwo"/>
The text = "@ {inputtwo. Text}" in the Code implements bidirectional binding.
<FX: binding source = "inputone. Text" Destination = "inputtwo. Text" twoway = "true"/>
Twoway = "true" indicates two-way binding.