Data Binding Through the ActionScript BindingUtils Class : BindingUtils « Data Model « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Data Model » BindingUtilsScreenshots 
Data Binding Through the ActionScript BindingUtils Class
Data Binding Through the ActionScript BindingUtils Class
         
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" horizontalAlign="center" verticalAlign="middle" initialize="initComp();">
    <mx:Model id="contacts">
        <contact>
            <name>
                <first />
                <last />
            </name>
        </contact>
    </mx:Model>
    <mx:Script>
        
        import mx.binding.utils.BindingUtils;
        private function initComp():void
        {
            BindingUtils.bindProperty(contacts, "name.first",firstNameInput, "text");
            BindingUtils.bindProperty(contacts, "name.last",lastNameInput, "text");

            BindingUtils.bindProperty(firstName, "text",contacts, "name.first");
            BindingUtils.bindProperty(lastName, "text", contacts,"name.last");
        }
      
    </mx:Script>
    <mx:Panel title="BindingUtils Class in ActionScript" horizontalAlign="center">
        <mx:Form>
            <mx:FormItem label="First Name">
                <mx:TextInput id="firstNameInput" />
            </mx:FormItem>
            <mx:FormItem label="Last Name">
                <mx:TextInput id="lastNameInput" />
            </mx:FormItem>
            <mx:FormItem label="First Name">
                <mx:Label id="firstName" text="{contacts.name.first}"
                    fontSize="15" fontWeight="bold" />
            </mx:FormItem>
            <mx:FormItem label="Last Name">
                <mx:Label id="lastName" text="{contacts.name.last}"
                    fontSize="15" fontWeight="bold" />
            </mx:FormItem>
        </mx:Form>
    </mx:Panel>
</mx:Application>

   
    
    
    
    
    
    
    
    
  
Related examples in the same category
1.Use BindingUtils to bind propertyUse BindingUtils to bind property
2.Bind with BindingUtils.bindSetterBind with BindingUtils.bindSetter
3.Bind Model with BindingUtils.bindPropertyBind Model with BindingUtils.bindProperty
4.Bind Setter using setter methodBind Setter using setter method
w___w__w___.__jav_a_2__s___.___c_o__m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.