Saturday, September 14, 2013

Two-way binding made easy in Flex 4

Dual/Two-way binding is really easy in Flex. To bind from variable/object property to control add the attribute[Bindable] to the variable/property and the braces {} to the control property. To bind from the control to the variable/property just at an asterisk before the braces @{}. That's it! Check out the link at the bottom of the page for property weaving (like code) in Flex.
[Bindable]
public var Question:String = "Please type a question here.";


 
  <![CDATA[
   import mx.controls.Alert;
   [Bindable]
   public var Question:String = "Please type a question here.";
   
   private function Init():void
   {
    //setup dual binding 
   }
  ]]>
 
 
  
 
 
  
  
 


Props to Frank Sommers!

No comments: