【问题标题】:Flex List Add a label and show textFlex List 添加标签并显示文本
【发布时间】:2012-02-19 15:39:24
【问题描述】:

我正在尝试将一个项目添加到列表中,并在我访问所选项目时显示文本并具有不同的隐藏值。我还需要使用循环来执行此操作。

目前我正在尝试添加标签并将标签 ID 设置为我的值。但该列表仅显示 ID 而不是文本。任何帮助将不胜感激。

var theLabel:Label = new Label();
theLabel.id = "123";
theLabel.text = "test";             
lstLayerList_array.addItem(theLabel);

<s:List id="lstLayerList" >
    <s:dataProvider>                
        <s:ArrayList id="lstLayerList_array">               
        </s:ArrayList>              
    </s:dataProvider>
</s:List>

【问题讨论】:

    标签: apache-flex list


    【解决方案1】:
    var theLabel:Label = new Label();
    theLabel.id = "123";
    theLabel.text = "test";             
    lstLayerList_array.addItem(theLabel);
    
    <s:List id="lstLayerList" labelField="text">
        <s:dataProvider>                
            <s:ArrayList id="lstLayerList_array">               
            </s:ArrayList>              
        </s:dataProvider>
    </s:List>
    

    【讨论】:

      【解决方案2】:

      将 labelField 属性设置为 theLabel.text。

      【讨论】:

      • 这不就是 theLabel.text = "test";是在做?我如何设置属性。谢谢!!!!
      猜你喜欢
      • 1970-01-01
      • 2011-04-01
      • 2010-12-06
      • 2017-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-02
      • 2017-03-04
      相关资源
      最近更新 更多