# Rollover detect bounding box NOT shape, how?

**URL:** https://forum.kirupa.com/t/rollover-detect-bounding-box-not-shape-how/264979
**Category:** flash
**Created:** [July 2, 2008, 6:18pm UTC](https://forum.kirupa.com/t/rollover-detect-bounding-box-not-shape-how/264979 "2008-07-02T18:18:06Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Exnem](https://avatars.discourse-cdn.com/v4/letter/e/c6cbf5/32.png) [@Exnem](https://forum.kirupa.com/u/Exnem)
#### Post date: [July 2, 2008, 6:18pm UTC](https://forum.kirupa.com/t/rollover-detect-bounding-box-not-shape-how/264979/1 "2008-07-02T18:18:06Z")

</div>

Does anyone know how to make the mouse detect the bounding box of a movie clip instead of the actual shape when rolled over?

I have some “buttons” that are really lines and are very hard to click so the mouse needs to detect the bouding box.

Thanks for any help.

---

<div class="post-metadata">

### Author: ![Alex\_Lexcuk](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@Alex\_Lexcuk](https://forum.kirupa.com/u/Alex_Lexcuk)
#### Post date: [July 2, 2008, 7:16pm UTC](https://forum.kirupa.com/t/rollover-detect-bounding-box-not-shape-how/264979/2 "2008-07-02T19:16:32Z")

</div>

create black square and give him alpha=0  
possible beside you clip is identified my\_mc

```auto

var rect_mc = new MovieClip(); 
my_mc.addChild(rect_mc);
rect_mc.graphics.beginFill( 0x990000, 0.5 );
rect_mc.graphics.drawRect(0, 0, 100, 50);//select you 0? 0? 100? 50?
rect_mc.endFill();
rect_mc.buttonMode = true;
rect_mc.alpha=0;

```

---

<div class="post-metadata">

### Author: ![Exnem](https://avatars.discourse-cdn.com/v4/letter/e/c6cbf5/32.png) [@Exnem](https://forum.kirupa.com/u/Exnem)
#### Post date: [July 2, 2008, 8:00pm UTC](https://forum.kirupa.com/t/rollover-detect-bounding-box-not-shape-how/264979/3 "2008-07-02T20:00:30Z")

</div>

Thanks for the help Alex 🙂

That is close to what I need, the problem is that I have hundreds of buttons and they are all accesed through code using a loop

Here’s the actual function for the buttons:

```auto
for (var i=1; i<=18; i++) {
 objName = "Face"+i+"btn";
 myButton = getChildByName(objName);
 myButton.buttonMode = true;
 myButton.addEventListener(MouseEvent.MOUSE_UP,onClickFace);
 
 myButton.addEventListener(MouseEvent.MOUSE_OVER,onMouseOverFace);
 myButton.addEventListener(MouseEvent.MOUSE_OUT,onMouseOutofFace);
}

```

So, the buttons are accesed by name, how will I use those rectangles in this example? I don’t really get how to enable those rects and at the same time function a the buttons which are accessed by name?.. Isn’t there something simpler? Obviously an “invisible button” is not the answer.

---

<div class="post-metadata">

### Author: ![okashira](https://avatars.discourse-cdn.com/v4/letter/o/71c47a/32.png) [@okashira](https://forum.kirupa.com/u/okashira)
#### Post date: [July 2, 2008, 8:15pm UTC](https://forum.kirupa.com/t/rollover-detect-bounding-box-not-shape-how/264979/4 "2008-07-02T20:15:28Z")

</div>

why not try making the hit area of the button the same size as the bounding box?

---

<div class="post-metadata">

### Author: ![Exnem](https://avatars.discourse-cdn.com/v4/letter/e/c6cbf5/32.png) [@Exnem](https://forum.kirupa.com/u/Exnem)
#### Post date: [July 2, 2008, 11:58pm UTC](https://forum.kirupa.com/t/rollover-detect-bounding-box-not-shape-how/264979/5 "2008-07-02T23:58:25Z")

</div>

Thanks for the help guys, I figured it out 😉
