Sometimes I see in a project im working at, the following:
text="@{myVar}"
What does that @ do?
Edit: text is a property in, for example, a TextArea component.
Sometimes I see in a project im working at, the following:
text="@{myVar}"
What does that @ do?
Edit: text is a property in, for example, a TextArea component.
The @ symbol is used for two way binding. Traditional binding is only one way. So, you have something like this in ActionScript:
[Bindable]
public var myValue:String = 'test';
And this in MXML
<s:TextInput id="myInput" text="{myValue}" />
myValue is the source, and the text property on the myInput is the destination.
When the myValue variable changes, the text property of the TextInput will change. However, if you type into the myInput; the value of myValue will not change.
This is one way binding. Changing the source (myValue) changes the destination (myInput.text), but changing the destination (myInput.text) does not change the source (myValue).
When you add the '@' it creates a two way binding:
<s:TextInput id="myInput" text="@{myValue}" />
So, now whenever myValue changes, the text property of TextInput will change. ( As in the previous sample). Whenever myInput.text changes, the myValue will also change (Different from the previous sample).
The '@', basically, makes both the values (myValue and myInput.text) a source and destination for binding.
You could accomplish the same thing without the '@' by using the Binding tag:
<fx:Binding source="myInput.text" destination="myValue " />
Is that a more in depth explanation for you?