关于获取textField的textFormat的使用总结
来源:互联网 发布:乳胶漆配色软件. 编辑:程序博客网 时间:2024/06/06 20:29
总结一下,虽说是小细节,以前总忽视,现在觉得高手往往在细节上比普通人了解多一些!下面有代码:
textField设样式有两种方式,一种是:_textField.defaultTextFormat=_format,另外一种是_textField.setTextFormat(_format);
如果要使用第一方式,_textField.text="good"要放在_textField.defaultTextFormat=_format之后。使用第二种方式的话,要放在_textField.setTextFormat(_format)
之前,否则样式不起作用。然后,要是想复用该_textField的TextFormat,最好使用_textField.defaultTextFormat=_format这种方式,或是_textField.getTextFormat(0,_textField.length-1);来实现在其样式在其他textField上的复用!
下面上代码:
package{
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
public class AirTest extends Sprite
{
private var _textField:TextField;
private var _format:TextFormat;
private var _format2:TextFormat;
public function AirTest()
{
_format=new TextFormat;
_format.bold=true;
_textField=new TextField;
/*_textField.defaultTextFormat=_format;*/
_textField.text="good";
_textField.setTextFormat(_format);
this.addChild(_textField);
_format2=_textField.defaultTextFormat;
_textField.getTextFormat(0,_textField.length-1);
}
}
}
0 0
- 关于获取textField的textFormat的使用总结
- 关于textfield的使用
- as3中TextFormat类的使用
- TextField和TextFormat
- AS3 TextField TextFormat随笔
- 关于textView,textField及delegate的使用
- [Fl][转]as3中TextFormat类的使用
- as3:TextField的使用
- TextField的简单使用
- TextField的使用
- 获取searchbar里的textField
- 关于textfield的一些细节
- AS3 TextField 类的使用
- textView、textField ReturnKey 的使用
- Cocos2d-x TextField的使用
- 获取UITableViewCell上textField值的方法
- TextField获取文字的长度和宽度
- iOS TextField 获取光标的位置
- POJ 题目分类
- android4.4.2源码和内核编译——图文详细记录
- Mac环境Sublime text2解决中文乱码的问题
- 博弈论
- 【微信分享】李滔:搜狐基于Spark的新闻和广告推荐实战
- 关于获取textField的textFormat的使用总结
- 俄罗斯轮盘(Russian Roulette)
- DSP、CAN、USB、以太网系统
- UVA 10167 Birthday Cake
- cocos生成keystore及其项目配置的一些BUG
- xcode语法高亮插件
- lua中“类”的实现
- 倾情大奉送--Spark入门实战系列
- 大数据的机遇与挑战:清华、复旦、中科院、春雨移动及考拉征信专家的观点