减少影片剪辑按钮上的点击区域

发布于 2024-09-24 06:14:25 字数 370 浏览 9 评论 0原文

大家好,有一个小问题需要解决。我创建了一个影片剪辑按钮,其中包含 2 个文本字段,一个静态,一个动态。动态文本字段包含长度不同的字符串。该 MC 通常用作按钮,因此我想做的不是让点击区域与文本框的长度一样大。

如果您访问 http://bodog-bonuses.com/mevame/ 并点击 (takeout > 菜单)您将在菜单上看到列出的所有项目都重叠在图片上,我想限制点击区域,这样就不会发生这种情况。我无法缩短 MC,因为它的长度会有所不同,如果它确实变得那么长,那么该部分不应该是可点击的。

如有任何帮助,我们将不胜感激,谢谢。

Hey guys, have a little issue i need to figure out. I created a movie clip button that contains 2 text fields, one static and one dynamic. The dynamic text field holds strings that will vary in length. This MC in general is used as a button so what im trying to do is not have the hit area as large as the length of the text box.

If you go to http://bodog-bonuses.com/mevame/ and click on (takeout > menu) you will see on the menu all the items listed are overlapping onto the picture, i want to limit the hit area so that does not happen. I cannot shorten the MC because it will vary in length, and if it does become that long then that portion should not be clickable.

Any help is appreciated, thank you.

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

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

发布评论

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

评论(3

吻风 2024-10-01 06:14:25

我没有看到您所描述的问题,但是将 TextField 的最大设置宽度与应用于 TextField 的 autoSize 属性的 TextFieldAutoSize.LEFT 相结合应该允许按钮根据需要垂直增长,而不会水平重叠图像。

I don't see the problem you are describing, however combining a maximum set width to the TextField with TextFieldAutoSize.LEFT applied to the autoSize property of the TextField should allow the button to grow vertically as needed without overlapping over the image horizontally.

执手闯天涯 2024-10-01 06:14:25

嗯,这是不可能的..因为两个文本字段都是影片剪辑的子字段,因此如果任何文本字段的大小增加,影片剪辑的宽度也会增加。
不过,我给你提供了示例逻辑,可能会对你有所帮助。
box 是您的影片剪辑,其中包含两个文本字段,现在在事件侦听器中您可以

box.addEventListener(MouseEvent.CLICK, showMovieClip);

function showMovieClip(evvt:MouseEvent):void

{

if(box.mouseY < (box.height/2))trace("half of the Movie-Clip height is click able")
if(box.mouseX < (box.width/2))trace("half of the Movie-Clip width is click able ")

}

这两个条件可以让你知道点击的位置。您可以使用其中任何一个或两者都使用,具体取决于您的要求。

Well, this is not possible.. because both the text-fields are the Child of the Movie-Clip so if the the size of any text-field increases, the width of Movie-Clip also increases.
However , i am giving you sample logic which may help you..
box is your movie-clip which contains two text-fields, now in the event listener you can

box.addEventListener(MouseEvent.CLICK, showMovieClip);

function showMovieClip(evvt:MouseEvent):void

{

if(box.mouseY < (box.height/2))trace("half of the Movie-Clip height is click able")
if(box.mouseX < (box.width/2))trace("half of the Movie-Clip width is click able ")

}

These two conditions will allow you to know where it is click . You can use any of them or both , depends on your requirement.

一个人练习一个人 2024-10-01 06:14:25

我会在盒子的 movieclip 中放置一个较小的方块,您希望将其作为实际的点击区域。如果您要调用内部较小的方块hitBoxMC,那么您可以通过boxMC.hitBoxMC.hitTestObject(Blah....);来访问它

I would put a smaller square in the box's movieclip that you want to be the actual hit area. If you were to call the inner smaller square hitBoxMC then you could access it by going boxMC.hitBoxMC.hitTestObject(Blah....);

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