Jump to content


Movie clip button hit area


  • You cannot reply to this topic
1 reply to this topic

#1 porgeet

    Young Padawan

  • Members
  • Pip
  • 9 posts
  • Gender:Male

Posted 24 June 2006 - 04:45 PM

Hello there.

I am having trouble with some buttons I have created using movie clips.
The reason I have used movie clips is because I want a rollover, and rollout animation.

So picture this...

I have a movie clip button that has a little bit pop out of it, it all works fine. BUT, not! Because that little bit that popped out is now an active part of the button causing it to stutter should the user roll over it during it's animation.

My question is this...

Is there any way of defining a hit area for a movie clip button?

I was thinking of using a stroke and the getBounds function. But as I'm new to Flash and all this actionscript malarke I'm not shure what I would do if I used it.

Help would be much appreciated.

Thanks

#2 porgeet

    Young Padawan

  • Members
  • Pip
  • 9 posts
  • Gender:Male

Posted 25 June 2006 - 09:24 AM

So I tried using the getBounds function. Here is what I ended up with...

button_mc.onRollOver = outSide;

var a = stroke.getBounds (_root);

function outSide () {
	if (_xmouse<a.xMin || _xmouse>a.xMax || _ymouse<a.yMin || _ymouse>a.yMax){
	delete this.onRollOver;
	
	}
}

this.button_mc.onRollOver = function () {
	button_mc.gotoAndPlay("_over");
	
}

this.button_mc.onRollOut = function () {
	button_mc.gotoAndPlay("_out");
}
  • Ive made a stroke movie clip that spans the parameter of my button
  • Then gave an instance name of stroke
  • Placed it accordingly over my button on the root timeline
The button still works, but it still has that annoying glitch.The only thing I think is wrong with the code is that I'm telling the button to do two things onRollOver. But then again I am checking if the mouse is outside the stroke parameter to then delete the onRollOver event.

I'm newish to actionscript so I don't know how to get around this problem. Or if this is indeed the right way to combat it.

Please help :love:

Edit

Found out how to do it. There is a hitArea definition in Flash :D

Edited by porgeet, 25 June 2006 - 01:25 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users