求输入时遇到关键字高亮显示

myeclipse0123 2010-09-15 09:53:19
如题
...全文
97 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
myeclipse0123 2010-09-17
  • 打赏
  • 举报
回复
和一楼的有区别吗?
myeclipse0123 2010-09-15
  • 打赏
  • 举报
回复
大哥,能不能给加上样式啊,一楼的我用了,就是不会加上样式
leemiki 2010-09-15
  • 打赏
  • 举报
回复
高亮显示只是设定样式而已

主要是一个字符串匹配处理的问题

以前用写过的一段关键字匹配,可以参照下思路
for (intTmp=0;intTmp<arrList.length;intTmp++){
for(i=0;i<arrList[intTmp].length;i++){
if (arrList[intTmp].substr(i, strInput.length).toUpperCase()==strInput.toUpperCase()){
addOption(arrList[intTmp],strInput);
}
}
}
passself 2010-09-15
  • 打赏
  • 举报
回复

private function input_text():void{
var content:String = input.text;
labe.text = StringReplaceAll(content,"abc","<bold>abc</bold>");
}
private function StringReplaceAll(source:String, find:String, replacement:String ):String{
return source.split( find ).join( replacement );
}


<mx:TextInput id="input" change="input_text()" />
<mx:Label text="" id="labe" />

大约就是这样,实在不行就用富文本
水中影子 2010-09-15
  • 打赏
  • 举报
回复
labe.text = StringReplaceAll(content,"abc","<font size="12" color="red">abc</font>");

试试

4,328

社区成员

发帖
与我相关
我的任务
社区描述
多媒体/设计 Flex
社区管理员
  • Flex
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧