0 Replies Latest reply on Jul 20, 2009 10:46 AM by Louder6Pounder

    Question on binding

    Louder6Pounder Level 1

      Not sure if data binding is what i require but i wish to do this:


      What i'm trying to do is update a a variable in a class as a user types in a text input within another class....if that makes sense.  So i have this class below, which builds a input form, when the user types in the "setText" function it fires a onchange event.  I want the value of that text input to be then passed to a property of another class


      package components{
           import flash.events.Event;
           import mx.containers.Form;
           import mx.containers.FormHeading;
           import mx.containers.FormItem;
           import mx.controls.RadioButton;
           import mx.controls.TextInput;
           public class PropertiesForm extends Form{
                public var test:String;
                public function PropertiesForm(){
                     this.id = 'componentProperties';
                     this.width = 274;
                     var heading:FormHeading = new FormHeading;
                     heading.label = 'Properties';
                public function clear():void{
                private function changeHandler(event:Event):void{
                //  Creates a text input 
                public function setText(label:String, type:String):void{
                     var newFormItem:FormItem = new FormItem;
                     var newTextInput:TextInput = new TextInput;
                     newFormItem.label = label;
                     newTextInput.id = type;
                     newTextInput.addEventListener(Event.CHANGE, changeHandler);
                //  Creates a boolean input instance
                public function setBool(label:String, type:String):void{          
                     var newFormItem:FormItem = new FormItem;
                     var newRadioButtonTrue:RadioButton = new RadioButton;
                     var newRadioButtonFalse:RadioButton = new RadioButton;
                     newFormItem.label = label;
                     //  Radio group
                     newRadioButtonTrue.groupName = type;
                     newRadioButtonFalse.groupName = type;
                     //  Radio id
                     newRadioButtonTrue.id = 'true';
                     newRadioButtonFalse.id = 'false';
                     //  Radio label
                     newRadioButtonTrue.label = 'True';
                     newRadioButtonFalse.label = 'False';
                     //  Add new components


      here is the class that i want to pass the value to. 


      package components{
           import mx.controls.Alert;
           import mx.controls.TextArea;
           public class KamTextArea extends TextArea{
                public var label:String;
                public var required:Boolean;
                public function KamTextArea(){
                     label = "Null";
                     required = false;                                         
                public function setupProperties(propertyInstance:PropertiesForm):void{
                     propertyInstance.setBool('Required', 'required');


      So i want the label variable in this class to be equal to what the user types inthe propertyInstance.setText function. 


      Thanks for any help.