I have a class that I want to be bindable with text fields... When the text field gets updated, the value for the attribute in the class should be updated. The problem is that's not happening the way I thought it should. Am I doing something wrong, or do I have the wrong  idea about the capability of databinding???
 
 
When the "asdf" button is clicked, I'm expecting it to display what's in the lastName field, but based on the updated attribute from the TexInpu.
 
package com.viva.model
{
 [Bindable]
 public class RecordData
 {
  public var recordID:int;
  public var firstName:String = 'Douglas';
  public var middleName:String;
  public var lastName:String;
  public var address:String;
  public var city:String;
  public var state:String;
  public var zip:String;
  public var heightFt:Number;
  public var heightIn:Number;
  public var weight:Number;
  public var hairColor:String;
  public var eyeColor:String;
  public var dob:Date;
  
  public function RecordData():void {
   // constructor
  }
 }
}
 
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox
 xmlns:mx="http://www.adobe.com/2006/mxml"
 label="Name / Address"
 width="100%"
 height="100%">
 
 <mx:Script>
  <![CDATA[
   import mx.controls.Alert;
   import com.viva.model.RecordData;
   
   [Bindable]
   public var record:RecordData = new RecordData();
      
  ]]>
 </mx:Script>
 
 <mx:HBox>
  <mx:Form>
   <mx:FormHeading label="Defendant Name" />
   <mx:FormItem label="First Name">
    <mx:TextInput id="firstName" text="{ record.firstName}" />
   </mx:FormItem>
   <mx:FormItem label="Middle Name">
    <mx:TextInput id="middleName" text="{record.middleName}" />
   </mx:FormItem>
   <mx:FormItem label="Last Name">
    <mx:TextInput id="lastName" text="{record.lastName}" />
   </mx:FormItem>
  </mx:Form>
 
  <mx:Form>
   <mx:FormHeading label="Address" />
   <mx:FormItem label="Number/Street">
    <mx:TextInput />
   </mx:FormItem>
   <mx:FormItem label="City">
    <mx:TextInput />
   </mx:FormItem>
   <mx:FormItem label="State">
    <mx:TextInput />
   </mx:FormItem>
   <mx:FormItem label="Zip Code">
    <mx:TextInput maxChars="9" width="100" restrict="0-9" />
   </mx:FormItem>
  </mx:Form>
  <mx:Button label="asdf" click="mx.controls.Alert.show(record.lastName)" />
 </mx:HBox>
</mx:VBox>
__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to