5 Replies Latest reply on Sep 18, 2006 2:00 AM by Matlus

    e4x syntax and determining the attribute name at runtime

    Matlus Level 1
      I'd like to be able to determine the attribute to use to say assign to a <mx:Label> in my ItemRenderer at runtime.
      The dataProvider is an XMLList. My ItemRenderer (partially) looks like this:

      <mx:Repeater id="ItemRepeater">
      <mx:Text text="{ItemRepeater.currentItem.@[labelField]}" width="100%" height="100%"/>
      </mx:Repeater>

      labelField is a property of the ItemRender and is set from the "outside".
      If the text property is is set to be
      <mx:Text text="{ItemRepeater.currentItem.@area_name}" width="100%" height="100%"/>

      (where area_name is an attribute of the currentItem) it works just fine.
      But as it stands now:
      <mx:Text text="{ItemRepeater.currentItem.@[labelField]}" width="100%" height="100%"/>

      I get an Internal Build Error and am unable to proceed.

      So my question is, is there another way to extract an attribute whose name is only known at runtime? I know that this syntax works in other cases, just not in an ItemRenderer situation.

      Thanks.



      In an ItemRenderer