【问题标题】:flex adaptative textinput function of maxcharsmaxchars的flex自适应文本输入功能
【发布时间】:2011-11-17 16:46:36
【问题描述】:

我想构建一个文本输入,它可以根据其 textdisplay 的 maxchars 值进行自我调整。

我试图像这样覆盖组件的 init 函数:

override protected function initializationComplete():void{
   if(this.textDisplay.maxChars != 0){
      this.maxWidth = this.textDisplay.maxChars*10;
      super.initializationComplete();
   }
}

但它根本不起作用。我该如何编码?

【问题讨论】:

  • 您想构建一个TextInput,它可以根据它的textDisplay 的maxchars 值HOW 进行自我调整吗?您希望 TextInput 发生什么样的变化?什么时候应该发生这种变化?

标签: apache-flex textinput


【解决方案1】:

在名为 widthInChars 的 s:textinput 属性中已经存在 像这样将该值设置为 maxChars 值

我是 mxml

<s:TextInput id="txtName" widthInChars="{txtName.maxChars}" maxChars="23" />

作为

txtName.widthInChars = txtName.maxChars;

试试这个 希望对您有所帮助。

【讨论】:

  • 感谢它的魅力。我只有一条警告消息:“数据绑定将无法检测到 maxChars 的分配”
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-10-11
  • 1970-01-01
  • 2012-04-22
  • 1970-01-01
  • 2013-11-28
  • 1970-01-01
相关资源
最近更新 更多