I have a label inside a repeater (rptInfos), and I have an arraycollection (Texts) that has the translations. The "Texts" content is changing when I change the language, and normally I use {Texts.getItemAt(219}} for example when I need a translated text. But in the repeater I have a translat开发者_运维百科eable column, so I want to use it like this:
<s:Label text="{Texts.getItemAt(rptInfos.currentItem.DictID as int)}" />
but it says "Syntax error: expected a definition keyword (such as function) after attribute , not target" I wanted to translate it in the labels creationComplete event, but than I can forget about binding, so only when reloaded can I have the content to update.
This is just a wild guess: try
<s:Label text="{Texts.getItemAt(Number(rptInfos.currentItem.DictID))}" />
A not so nice, but working solution :S
<s:Label text="{rptInfos.currentItem.DictID==254?Texts.getItemAt(254):
rptInfos.currentItem.DictID==255?Texts.getItemAt(255):
rptInfos.currentItem.DictID==256?Texts.getItemAt(256):
rptInfos.currentItem.DictID==257?Texts.getItemAt(257):
rptInfos.currentItem.DictID==258?Texts.getItemAt(258):
rptInfos.currentItem.DictID==259?Texts.getItemAt(259):''}" />
精彩评论