# Grid question of sorts

**URL:** <https://forum.kirupa.com/t/grid-question-of-sorts/245460>\
**Category:** Uncategorized\
**Created:** [November 29, 2007, 10:15pm UTC](https://forum.kirupa.com/t/grid-question-of-sorts/245460 "2007-11-29T22:15:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Awesome\_O\_4000](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@Awesome\_O\_4000](https://forum.kirupa.com/u/Awesome_O_4000)\
**Post date:** [November 29, 2007, 10:15pm UTC](https://forum.kirupa.com/t/grid-question-of-sorts/245460/1 "2007-11-29T22:15:40Z")

</div>

K, so I’ve populated a grid out of a Box class in the library. I’m trying to make sure it works and stuff, and uh, it doesn’t. I have a Mouse Event going, but it only affects one box out of the 30 on the stage, and I have no idea why. The trace statement works with every one. Same with a buttonMode = true. Could someone take a look and point me in the right direction? I’ll attach my .fla in addition to the code below.

```auto

import caurina.transitions.Tweener;

var spacing:Number = 10;
var box:Box = new Box();
var numberofRows:Number = 0;
var numberofCols:Number = 0;

for (var i:Number = 0; i<30; i++) {
    box = new Box();
    box.x = (box.width+spacing) * numberofRows;
    box.y = (box.height+spacing) * numberofCols;
    addChild(box);
    box.x = 120 + (box.width+spacing) * numberofRows;
    box.y = 50 + (box.height+spacing) * numberofCols;
    box.buttonMode = true;

    box.addEventListener(MouseEvent.MOUSE_OVER, overHandler);
    box.addEventListener(MouseEvent.MOUSE_OUT, outHandler);
    box.addEventListener(MouseEvent.CLICK, clickHandler);

    function overHandler(event:MouseEvent):void {
        Tweener.addTween(box, {alpha:.25, time:1.5});
        trace("alpha down");
    }
    function outHandler(event:MouseEvent):void {
        Tweener.addTween(box, {alpha:1, time:2});
        trace("alpha back up");
    }
    function clickHandler(event:MouseEvent):void {
        removeChild(box);
    }

    if (numberofRows >= 5) {
        numberofRows = 0;
        numberofCols++;
    } else {
        numberofRows++;
    }
}

```
