减少影片剪辑按钮上的点击区域
大家好,有一个小问题需要解决。我创建了一个影片剪辑按钮,其中包含 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我没有看到您所描述的问题,但是将 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.
嗯,这是不可能的..因为两个文本字段都是影片剪辑的子字段,因此如果任何文本字段的大小增加,影片剪辑的宽度也会增加。
不过,我给你提供了示例逻辑,可能会对你有所帮助。
box 是您的影片剪辑,其中包含两个文本字段,现在在事件侦听器中您可以
box.addEventListener(MouseEvent.CLICK, showMovieClip);
function showMovieClip(evvt:MouseEvent):void
{
}
这两个条件可以让你知道点击的位置。您可以使用其中任何一个或两者都使用,具体取决于您的要求。
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
{
}
These two conditions will allow you to know where it is click . You can use any of them or both , depends on your requirement.
我会在盒子的
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 squarehitBoxMC
then you could access it by goingboxMC.hitBoxMC.hitTestObject(Blah....);