【问题标题】:how to edit button text in custom components in flex?如何在flex中编辑自定义组件中的按钮文本?
【发布时间】:2011-04-16 11:33:51
【问题描述】:

我在 flex 中创建了自定义组件,我使用了一个按钮,我想在其他 mmxl 文件中使用该组件时更改按钮文本,我该怎么做?在此先感谢下面是代码

【问题讨论】:

    标签: apache-flex flex3 flexbuilder


    【解决方案1】:

    只需在自定义组件中为按钮标签引入一个属性,如下所示:

    [Bindable]
    public var buttonLabel:String = "Default Label";
    

    并通过以下方式将按钮的标签与该属性绑定在同一组件中:

    <mx:Button label="{buttonLabel}" />
    

    所以使用非常简单。假设您的组件名称是 MyComponent:

    <MyComponent buttonLabel="My Custom Label" />
    

    希望这会有所帮助:)

    【讨论】:

      猜你喜欢
      • 2010-11-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-22
      • 2016-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多