Bind Data Model to Label : Label Data « Components « Flex





Bind Data Model to Label

Bind Data Model to Label
           
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="#FFFFFF">
  <mx:Model id="contactmodel">
    <contact>
      <fname>First</fname>
      <lname>Last</lname>
      <address>101 St.</address>
      <city>My City</city>
      <state>NY</state>
      <zip>11111</zip>
      <phone>516-555-9999</phone>
      <email>pro@gmail.com</email>
    </contact>
  </mx:Model>
  <mx:Panel title="Contact Info" width="200" height="170">
    <mx:Label text="{contactmodel.fname} {contactmodel.lname}" />
    <mx:Label text="{contactmodel.address}" />
    <mx:Label text="{contactmodel.city} {contactmodel.state}, {contactmodel.zip}" />
    <mx:Label text="{contactmodel.phone}" />
    <mx:Label text="{contactmodel.email}" />
  </mx:Panel>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
  










Related examples in the same category

1.Define Data Model in Model tag and use it with LabelDefine Data Model in Model tag and use it with Label
2.Use categoryField property to point to the field in the data provider that contains the labels for the axisUse categoryField property to point to the field in the data provider that contains the labels for the axis
3.Generates data labels for a PieSeries object that include data and formattingGenerates data labels for a PieSeries object that include data and formatting
4.Add an axis solely for the purpose of adding the label to the DataTipAdd an axis solely for the purpose of adding the label to the DataTip
5.Use the updateDataChild() method to add a label to a single data point on the lineUse the updateDataChild() method to add a label to a single data point on the line