Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the "@" do?

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.

like image 782
Artemix Avatar asked Nov 16 '11 20:11

Artemix


People also ask

Is Osteopathic Medicine?

Osteopathic medicine is a "whole person" approach to medicine—treating the entire person rather than just the symptoms. With a focus on preventive health care, Doctors of Osteopathic Medicine (DOs) help patients develop attitudes and lifestyles that don't just fight illness, but help prevent it, too.

What does do stand for in doctor?

A doctor of osteopathic medicine (D.O.) is a fully trained and licensed doctor who has attended and graduated from a U.S. osteopathic medical school. A doctor of medicine (M.D.) has attended and graduated from a conventional medical school.

What do osteopaths do?

An osteopath aims to restore the normal function and stability of the joints to help the body heal itself. They use their hands to treat your body in a variety of ways, using a mixture of gentle and forceful techniques. Techniques are chosen based on the individual patient and the symptoms they have reported.

What does MD stand for in medical terms?

MD stands for doctor of medicine. It is a designation that indicates someone who has completed medical school.


1 Answers

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?

like image 53
JeffryHouser Avatar answered Nov 14 '22 06:11

JeffryHouser