Flex Data Binding

Source: Internet
Author: User

// 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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.