Skip to content

Instantly share code, notes, and snippets.

@mrinalwadhwa
Created May 29, 2010 02:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrinalwadhwa/417981 to your computer and use it in GitHub Desktop.
Save mrinalwadhwa/417981 to your computer and use it in GitHub Desktop.
package
{
import flash.text.TextField;
import flash.display.Sprite;
import crayons.data.binding.Binder;
public class Example extends Sprite
{
private var source:SomeModel;
private var target:TextField;
private var binder:Binder;
public function Example()
{
super();
// you only need one of these throughout your app
binder = new Binder();
source = new SomeModel();
target = new TextField();
addChild(target);
// this binds source.data to target.text,
// provided source dispatches dataChanged when its data property changes
binder.bind(source.dataChanged, target, "text");
// this should set the text property in the target text field
source.data = "Data Binding !";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment