Created
May 29, 2010 02:39
-
-
Save mrinalwadhwa/417981 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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