R – Flex: Binding to an MXML-esque “binding string” in action script

actionscriptapache-flexdata-bindingmxml

Is it possible to specify MXML-esque "binding strings" in ActionScript?

For example, I want to be able to do something like:

MXMLBinding(this, "first_item",
            this, "{myArrayCollection.getItemAt(0)");
MXMLBinding(this, ["nameLbl", "text"],
            this, "Name: {somePerson.first} {somePerson.last}");

Edit: thanks for the responses and suggestions… Basically, it seems like you can't do this. I've dug around and figured out why.

Best Answer

(Shameless plug)

BindageTools can do this:

Bind.fromProperty(this, "myArrayCollection", itemAt(0))
    .toProperty(this, "first_item");

Bind.fromAll(
    Bind.fromProperty(this, "somePerson.first"),
    Bind.fromProperty(this, "somePerson.last")
    )
    .format("Name: {0} {1}")
    .toProperty(this, "nameLbl.text");

Note that BindageTools puts the source object first and the destination last (whereas BindingUtils puts the destination first and the source last).

Related Topic