Create a set function

Set up a function that references whenever the underlying data model item changes. The function uses the binding value of the data model item to obtain the value of the item. For example, the following MXML demonstrates a reference to the value of a data model item, empName, that stores an employee name:

<?xml version="1.0" encoding="utf-8"?> 
<gc:Wrapper width="100%" height="100%" 
    xmlns:mx="http://www.adobe.com/2006/mxml" 
    xmlns:gc="ga.controls.*" > 
     
    <mx:Script> 
        <![CDATA[ 
 
            Wrapper.instance.bindSetter("Services.employee.empName", empNameSetter); 
 
            private function empNameSetter( value:Object ):void 
            { 
                var empName:String = value as String;  // cast to appropriate type 
                If ( empName == "Tony Blue" ) { 
                    // do something here 
                } 
            } 
        ]]> 
    </mx:Script> 
 
    <mx:VBox width="100%" height="100%"> 
        <gc:PanelContent width="100%" height="100%" /> 
        <mx:HBox> 
            <gc:PreviousPanelButton label="Back" /> 
            <gc:NextPanelButton label="Forward" /> 
            <gc:SubmitButton label="Submit Data" /> 
        </mx:HBox> 
    </mx:VBox> 
</gc:Wrapper>

Each time the Services.employee.empName data item changes value, the named function executes with the value of the item. For example, you could save the value locally and have MXML controls use that local variable as their {data provider} .

// Ethnio survey code removed