# Why is this NULL?

**URL:** <https://forum.kirupa.com/t/why-is-this-null/320356>\
**Category:** flash\
**Created:** [March 21, 2011, 3:34pm UTC](https://forum.kirupa.com/t/why-is-this-null/320356 "2011-03-21T15:34:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![megshea](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@megshea](https://forum.kirupa.com/u/megshea)\
**Post date:** [March 21, 2011, 3:34pm UTC](https://forum.kirupa.com/t/why-is-this-null/320356/1 "2011-03-21T15:34:12Z")

</div>

When I run this snippet of code, I am getting “TypeError: Error #1009: Cannot access a property or method of a null object reference.  
at mouseMoveSlider02\_fla::MainTimeline/init()  
at mouseMoveSlider02\_fla::MainTimeline/frame1()”

Please help if you could. Many thanks.

```auto

var guideBoxes:Array = [];

function init(e:Event = null):void
{
    removeEventListener(Event.ADDED_TO_STAGE, init);

    var nextXPos:Number;
    var mc:MovieClip;

    for (var i:int = 1; i < 10; i++)
    {
        nextXPos = i*(boxWidth+boxMargin);

        mc = new MovieClip();
        mc.name = "mc" + i.toString();
        mc.graphics.beginFill(0xff1111);
        mc.graphics.drawRect(nextXPos, 0, boxWidth, boxHeight+boxMargin);
        mc.addEventListener(MouseEvent.CLICK, doButton);

        addChild(mc);

        guideBoxes* = mc;
    }

    trace((guideBoxes[0] as MovieClip).name);
    trace((guideBoxes[1] as MovieClip).name);

    stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
    container.addEventListener(MouseEvent.ROLL_OVER, rollOverHandler);
    container.addEventListener(MouseEvent.ROLL_OUT, rollOutHandler);
}

```
