Flex Dynamic Data Binding 101 – Part Two

OK, so we’ve covered the basics of data binding in part one. However you don’t have to use Actionscript to use data binding. This is a very quick example of how you can bind two components together without using Actionscript at all. Click here to see the example.

And this is the code :

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">

	<mx:Label text="{input.text}"/>

	<mx:TextInput id="input" text="Type in here to change the label"/>

</mx:Application>

Simple you can get the code from this link -> Binding Components MXML Code.(Sorry, just moved the blog – examples back soon) Note that when binding components their properties are available for binding without using [Bindable] meta, this is only for Actionscript. This is a fairly useless example of data binding though. What may be useful would be to bind the enabled state of a button, for example a delete button, to the length of the array property of a list component. If the list component was empty, disable (or hide) the button. Or set the index of a view stack to the value of a radio group, or – er – OK this isn’t too useful. (Shorthand for – I’ve run out of good examples, lets get on and play with some more code.)

Next lets look at something that’s halfway towards a useful application of data binding.

Tags »

Author:admin
Date: Sunday, 13. January 2008 20:26
Trackback: Trackback-URL Category: Basic Code, Flex, Tutorials

Feed for the post RSS 2.0 Comment this post

Submit comment