Bind to a Generic Object : Object « Development « 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 » Development » ObjectScreenshots 
Bind to a Generic Object
Bind to a Generic Object
           
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        
            import mx.utils.ObjectProxy;
            
            private var obj:Object = {name:'Name',album:'Song',genre:'Rock'};
            
            [Bindable]
            private var proxy:ObjectProxy = new ObjectProxyobj );
            
            private function handleClick():void
            {
                proxy.name = nameField.text;
                proxy.album = albumField.text;
                proxy.genre = genreField.text;
            }
      
    </mx:Script>
    
    <mx:Form borderStyle="solid">
        <mx:FormItem label="Name:">
            <mx:TextInput id="nameField" />
        </mx:FormItem>
        <mx:FormItem label="Album:">
            <mx:TextInput id="albumField" />
        </mx:FormItem>
        <mx:FormItem label="Genre:">
            <mx:TextInput id="genreField" />
        </mx:FormItem>
        <mx:FormItem label="Submit Changes">
            <mx:Button label="ok" click="handleClick();" />
        </mx:FormItem>
    </mx:Form>
    
    <mx:Form borderStyle="solid">
        <mx:FormItem label="Name:">
            <s:RichText text="{proxy.name}" />
        </mx:FormItem>
        <mx:FormItem label="Album:">
            <s:RichText text="{proxy.album}" />
        </mx:FormItem>
        <mx:FormItem label="Genre:">
            <s:RichText text="{proxy.genre}" />
        </mx:FormItem>
    </mx:Form>
    
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
  
Related examples in the same category
1.Create an Object, adds properties, and inspect its propertiesCreate an Object, adds properties, and inspect its properties
2.Create a generic Object, adds properties to that objectCreate a generic Object, adds properties to that object
3.Define objects using properties directly in the Object tagsDefine objects using properties directly in the Object tags
4.Using source and property properties to specify an objectUsing source and property properties to specify an object
ww__w_._j__a_va___2s___._c_o__m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.