Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Flex Flex data binding example

Related Tutorials


 
 

Share on Google+Share on Google+

Flex data binding example

Advertisement
In the example below, data binding in flex is demonstrated.

Flex data binding example

     

In the example below, data binding in flex is demonstrated. Here data binding means binding or connecting the properties or attributes of flex controls to each other. In the example the text property of  flex control Text  contains a single pair of curly brace and  in the braces the value of text property of TextInput control  is invoked. In this way, the data binding is done in flex and due to this whenever the generated swf file is executed  in a web browser, the text attribute properties of both the flex controls Text and TextInput respectively will  possess the same value.

Syntax for binding: <mx:Text text =  { id_value.text }/>

Bind.mxml

<?xml version = '1.0' encoding = 'utf-8'?>
<mx:Application xmlns:mx = 'http://www.adobe.com/2006/mxml'>
  
  <mx:Style>
  .neo {color : green}
  Button {font-size : 10pt}
  </mx:Style>

  <mx:TitleWindow title = 'Flex Data Binding' showCloseButton
 'true' width = '40%' height = '30%' color = 'red'>
  <mx:TextInput id = 'ti' text = 'hello'/>
  <mx:Text text = '{ti.text}'/>
  
  <mx:Button label = 'Bind data' styleName = 'neo
  click = 'ti.text = "roseindia"'/>

  </mx:TitleWindow>
  
</mx:Application>
  

Bind.swf

Download the code

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: May 25, 2009

Related Tutorials

Discuss: Flex data binding example  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com