DFdou's Blog Life is short,Be yourself.

2610/090

AS3-如何让TextField鼠标出现手形?

这个问题来自http://flash.9ria.com/thread-25870-1-1.html
我以前的处理方法是放空MC,也就是4楼的做法:

import flash.events.MouseEvent;
var txt:TextField = new TextField();
txt.text = "wonderful";
txt.x=200;
txt.y=200;
txt.autoSize = TextFieldAutoSize.LEFT;
addChild(txt);
var format:TextFormat = new TextFormat("Arial",30,0x9900000);
txt.setTextFormat(format);
var mc:Sprite = new Sprite();
mc.graphics.beginFill(0x000000,0);
mc.graphics.drawRect(txt.x,txt.y,txt.textWidth,txt.textHeight);
mc.buttonMode = true;
addChild(mc);

6楼的做法也不错,不过问题是这只能用在CS4里,CS3还不支持~

mytx.addEventListener(MouseEvent.MOUSE_OVER,mousesj1);
mytx.addEventListener(MouseEvent.MOUSE_OUT,mousesj2);
function mousesj1(e:MouseEvent) {
        Mouse.cursor="button";       //当鼠标移到动态文本上时出现手形
}
function mousesj2(e:MouseEvent) {
        Mouse.cursor="arrow";        //当鼠标离开动态文本时取消手形,恢复为箭头
}

Some Related Posts

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

:zhuang :xizao :wuwu :wenhao :wc :touxiang :shuaya :shuajian :shengtian :paopao :no :meinv :maonv :loveu :leilei :kua :jrjr :dahan :chi :chaocai :byebye


CommentLuv Enabled

No trackbacks yet.