最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
TextField的,鼠标经过文本变色
时间:2008-07-23 编辑:简简单单 来源:一聚教程网
TextField的,鼠标经过文本变色//---------code by ycccc8202----------
var myText:TextField=new TextField()
myText.text="在人生的高速路上已经连续转错了不少弯"
myText.width=myText.
myText.x=myText.y=100
var myTextFormat_old=new TextFormat()
myTextFormat_old.color="0x000000"
myTextFormat_old.size=12
var myTextFormat_new=new TextFormat()
myTextFormat_new.color="0xff0000"
myTextFormat_new.size=24
function enterFrameListener(event:Event) {
myText.setTextFormat(myTextFormat_old);
var charIndex:int = myText.getCharIndexAtPoint(myText.mouseX,myText.mouseY);//不断取得指定位置的字符索引
if(charIndex==-1){//如果鼠标移出文本
return;}
myText.setTextFormat(myTextFormat_new,charIndex,charIndex+1);
}
addEventListener(Event.ENTER_FRAME, enterFrameListener);//注册桢循环事件
addChild(myText)
-
上一个: as 3.0 判断具体按钮的按下状态
-
下一个: as定义键盘按键动作
相关文章
- FLASH软件帧编辑功能怎么使用 06-22
- FLASH软件常用上色工具怎么使用 06-19
- flash怎么制作遮罩图片切换动画 06-19
- FLASH制作春意盎然花园效果 06-18
- 利用ae制作碎片文字动画 06-15
- flash图片怎么替换 06-14