flex : @ symbol: what's that ?

what is the @ symbol isgnification is FLEX ?

For instance :
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
   <mx:XML id="menus">
      <menus>
         <menu label="Fichier">
            <menu label="Ouvrir" />
            <menu label="Sauvegarder" />
            <menu label="Fermer" />
            <menu type="separator" />
            <menu label="Quitter" />
         </menu>
         <menu label="Edition">
            <menu label="Couper" />
            <menu label="Copier" />
            <menu label="Coller" />
         </menu>
      </menus>
   </mx:XML>
   
   <mx:MenuBar dataProvider="{menus.menu}" labelField="@label" right="10" top="10" left="10"/>
   
</mx:Application>
yarekAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
julianopolitoConnect With a Mentor Commented:
this is an operator for accessing E4X xml tag attributes. For example:

var doc:XML = <book label="My Book" />;
trace(doc.@label);//traces "My Book"

In the case you showed

<mx:MenuBar dataProvider="{menus.menu}" labelField="@label" right="10" top="10" left="10"/>

labelField must be told what is the property in the dataprovider that contains the labels for the menu items, in this case @label says GET ITEM LABELS FROM LABEL ATTRIBUTE OF TAGS
0
 
LordOfPortsCommented:
0
 
julianopolitoCommented:
Another example:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
   <mx:XML id="menus">
      <menus>
         <menu label="Fichier" name="John">
            <menu label="Ouvrir" name="Mac" />
            <menu label="Sauvegarder"  name="Mary" />
            <menu label="Fermer"  name="Zak"/>
            <menu type="separator" />
            <menu label="Quitter"  name="Peter" />
         </menu>
         <menu label="Edition" name="Orson">
            <menu label="Couper" name="Jack" />
            <menu label="Copier" name="Gabriel" />
            <menu label="Coller" name="Sam" />
         </menu>
      </menus>
   </mx:XML>
   
   <mx:MenuBar dataProvider="{menus.menu}" labelField="@name" right="10" top="10" left="10"/>
   
</mx:Application>


In this case instead of menu items named with label, they will be labeled with names. Try it.



0
All Courses

From novice to tech pro — start learning today.