Select to view content in your preferred language

Label Binding From XML

1022
1
05-27-2010 11:35 AM
SpencerKerns
Emerging Contributor
I have an actionscript class that reads strings values from an XML file and assigns them to private class variables.  The class is declared as [Bindable].  I have a get method declared for each private variable:

public function get buttonLabel():String
{
     return _buttonLabel || "Search";
}

I then use the value to populate the label attribute of the MXML tag:

<mx:Button id="btnSearch" label="{labelData.buttonLabel}"/>

The problem that I am having is that sometimes when the application is displayed no label appears and the user has to refresh to see all the appropriate labels.  The users have indicated that this makes the application difficult to use as they are unaware of what to enter in text boxes or other items as there are no labels.

      I know this is more of a pure FLEX question than an ArcGIS API question but I hope that since that someone would have possibly had a similar problem or might have a suggestion for how to improve the reliability of the labels.
Tags (2)
0 Kudos
1 Reply
DasaPaddock
Esri Regular Contributor
Binding on read-only properties will only trigger if you tell it what event to watch for and you dispatch that event.

This is an example of the metadata you'd add to each property:

[Bindable(event="fooChanged")]

It may be easier to just make your properties read/write.
0 Kudos