Flex/Flash:不显示“栏”拖动文本字段/文本区域时的光标?
正如标题所示,当我在 TextField
上单击并拖动时,如何防止出现“bar”光标?例如,考虑以下交互:
替代文本 http://img.skitch.com/20100601-dhsqsgfsjphfdf3eambshww72m .png
我想防止光标在步骤“2”中更改为“bar”。
我怎样才能做到这一点?
我尝试摆弄 selectable
标志:
protected static function fixMouseOverAfordance(field:TextField):void {
var iOwnClick:Boolean = false;
function handleMouseOver(event:MouseEvent):void {
if (event.buttonDown) {
field.selectable = iOwnClick;
} else {
field.selectable = true;
iOwnClick = false;
}
}
field.addEventListener(MouseEvent.MOUSE_OVER, handleMouseOver,
false, EventPriority.CURSOR_MANAGEMENT+1);
field.addEventListener(MouseEvent.ROLL_OVER, handleMouseOver,
false, EventPriority.CURSOR_MANAGEMENT+1);
field.addEventListener(MouseEvent.MOUSE_MOVE, handleMouseOver,
false, EventPriority.CURSOR_MANAGEMENT+1);
field.addEventListener(MouseEvent.MOUSE_DOWN,
function(event:MouseEvent):void {
iOwnClick = true;
field.selectable = true;
});
}
但是当鼠标第一次在文本字段上移动时,“bar”光标仍然出现(但是,在它被移出然后移回之后,它做了正确的事)。
As the title suggests, how can I prevent the "bar" cursor from appearing when I click-and-drag over a TextField
? For example, consider this interaction:
alt text http://img.skitch.com/20100601-dhsqsgfsjphfdf3eambshww72m.png
I'd like to prevent the cursor changing to the "bar" in step "2".
How can I do that?
I've tried fiddling with the selectable
flag:
protected static function fixMouseOverAfordance(field:TextField):void {
var iOwnClick:Boolean = false;
function handleMouseOver(event:MouseEvent):void {
if (event.buttonDown) {
field.selectable = iOwnClick;
} else {
field.selectable = true;
iOwnClick = false;
}
}
field.addEventListener(MouseEvent.MOUSE_OVER, handleMouseOver,
false, EventPriority.CURSOR_MANAGEMENT+1);
field.addEventListener(MouseEvent.ROLL_OVER, handleMouseOver,
false, EventPriority.CURSOR_MANAGEMENT+1);
field.addEventListener(MouseEvent.MOUSE_MOVE, handleMouseOver,
false, EventPriority.CURSOR_MANAGEMENT+1);
field.addEventListener(MouseEvent.MOUSE_DOWN,
function(event:MouseEvent):void {
iOwnClick = true;
field.selectable = true;
});
}
But the "bar" cursor still appears the first time the mouse is moved over the text field (however, after it has been moved out then moved back in, it does the right thing).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
透明MC在上面,适合吗?在黑暗中拍摄...
另外,不确定 mouseEnabled / mouseChildren 在这里会产生什么影响。
有趣的!
Transparent MC over the top, to fit? Shot in the dark...
Also, not sure what impact mouseEnabled / mouseChildren would have here.
Interesting!