dynamically increase buttons hit area  
Author Message
Trashcan





PostPosted: 11/11/2005 2:08:43 PM Top

Flash, dynamically increase buttons hit area I have a button, and on rollover I am showing a movieclip beneath the
button. I want to increase my hit area box so the total height of my
box is equall to my button & movieclip.

this is my code.

button:
on (rollOver) {
//bbCC is name of movieclip, btnCC is the name of the button
showbox(bbCC, btnCC);
}

_root:
function showbox(box:MovieClip, btn:Button):Void {
//first I'm tweening the _alpha of the box
//I'm using lazytween for this. can tween size as well as alpha val

box.tween("_alpha", 100, _root.seconds, "easein");
btn.hit.tween("_height, _width", [box._height, box._width],
_root.secondshit);

//tried just to set it, doesnt work
btn.hit._width=300;
}


I get the message that there is no property with the name hit. but I
have a movieclip inside my button which I have labeled hit..... seems
like a scope problem... but I'm not sure.

any ideas?

 
Ric





PostPosted: 11/21/2005 5:03:00 AM Top

Flash >> dynamically increase buttons hit area You can't target movieclips in button instances, use a movieclip as a button
to set the hit area
movieclips as buttons gives you much more control because you can add as
many labels as you wish
just create a movieclip with you movieclip for the over state in it, name it
and activate it with instanceName.onRelease=function(){ };

Rich


--
<!-- saved from url=(0013)about:internet -->
"Trashcan" <email***@***.com> wrote in message
news:email***@***.com...
>I have a button, and on rollover I am showing a movieclip beneath the
> button. I want to increase my hit area box so the total height of my
> box is equall to my button & movieclip.
>
> this is my code.
>
> button:
> on (rollOver) {
> //bbCC is name of movieclip, btnCC is the name of the button
> showbox(bbCC, btnCC);
> }
>
> _root:
> function showbox(box:MovieClip, btn:Button):Void {
> //first I'm tweening the _alpha of the box
> //I'm using lazytween for this. can tween size as well as alpha val
>
> box.tween("_alpha", 100, _root.seconds, "easein");
> btn.hit.tween("_height, _width", [box._height, box._width],
> _root.secondshit);
>
> //tried just to set it, doesnt work
> btn.hit._width=300;
> }
>
>
> I get the message that there is no property with the name hit. but I
> have a movieclip inside my button which I have labeled hit..... seems
> like a scope problem... but I'm not sure.
>
> any ideas?
>