views:

79

answers:

3

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.

+2  A: 

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.

Tegeril
Damn this is a huge help! thanks bro
1337holiday
A: 

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.

Muhammad Irfan
A: 

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....);

Harold