Saturday, September 1, 2012

ActionScript 3.0 Binding

I wanted to implement the equivalent to:

    public var str:String = "Default literal";

<s:Label text="{str}" />

Using a ChangeWatcher singleton, I could identify the property I wanted to bind to and the method to call once that value changes. In this example, I use an nameless function, but you could easily use a function name and handle the callback there. Also note that this is self-referential but could reference any object available in this context., "property", function(e:Event):void{

No comments: