Flex Sprite 按钮模式

发布于 2024-08-26 15:59:47 字数 164 浏览 3 评论 0原文

我有一个精灵,在上面添加了两个文本字段
并排,水平。

我已经设置了精灵的按钮模式= true。
但鼠标光标从常规变为
仅当我将其悬停在文本字段上时才可单击。

在两个文本字段之间的空白区域中,
光标仍然显示为常规/正常。

为什么会这样?

I have a sprite on which I have added two textfields
side by side, horizontally.

I have set the buttonmode of sprite = true.
But the mouse cursor changes from regular to
clickable only when I hover it on the textfields.

In the empty area between the two textfields,
the cursor still appears regular/normal.

Why could it be?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

赠我空喜 2024-09-02 15:59:47

TextField 实例是占据 Sprite 中空间的唯一对象。因此,只有当它们悬停时才会出现手形光标。您需要做的是将 Sprite 的宽度和高度定义为其中的对象占用的最大空间(或者大于该值,如果您愿意),然后应用 buttonMode = true

var mySprite:Sprite = new Sprite();
mySprite.addChild(textField1);
mySprite.addChild(textField2);
mySprite.width = textField1.width + textField2.width + Math.abs(mySprite.textField2.x - mySprite.textField1.x);
mySprite.height = (textField1.height > textField2.height) ? textField1.height : textField2.height;
mySprite.buttonMode = true;

如果这不起作用,您可以查看文档:

http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/Sprite.html#buttonMode

The TextField instances are the only objects occupying space in the Sprite. Therefore, the hand cursor only appears when they are hovered. What you need to do is define the width and height of your Sprite to the maximum space occupied by your objects inside it (or greater than that, if you want), then apply buttonMode = true:

var mySprite:Sprite = new Sprite();
mySprite.addChild(textField1);
mySprite.addChild(textField2);
mySprite.width = textField1.width + textField2.width + Math.abs(mySprite.textField2.x - mySprite.textField1.x);
mySprite.height = (textField1.height > textField2.height) ? textField1.height : textField2.height;
mySprite.buttonMode = true;

If that doesn't work, you can check out the documentation:

http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/Sprite.html#buttonMode

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文