# TypeError: Error #1009

**URL:** <https://forum.kirupa.com/t/typeerror-error-1009/255282>\
**Category:** flash\
**Created:** [March 20, 2008, 6:55pm UTC](https://forum.kirupa.com/t/typeerror-error-1009/255282 "2008-03-20T18:55:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AJSimpson](https://avatars.discourse-cdn.com/v4/letter/a/df788c/32.png) [@AJSimpson](https://forum.kirupa.com/u/AJSimpson)\
**Post date:** [March 20, 2008, 6:55pm UTC](https://forum.kirupa.com/t/typeerror-error-1009/255282/1 "2008-03-20T18:55:31Z")

</div>

All I have on my stage is one MovieClip, instance-named “box\_mc”.

On Frame 1 (which is the only frame out there), I have this code:

[AS]  
import com.placement.LiquidLayout;

var newAligner:LiquidLayout = new LiquidLayout(box\_mc, 300, 300);  
addChild(newAligner);[/AS]

And in my class file (which is based on the StageManager class by [noponies.com](http://noponies.com)) I have this code:

[AS]  
package com.placement {

```
import flash.display.*;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;

public class LiquidLayout extends Sprite {
    
    //declaring the variables
    private var managedObject:InteractiveObject;
    private var xAxis:Number;
    private var yAxis:Number;
    
    //building the constructor
    public function LiquidLayout(target:InteractiveObject, xpos:Number, ypos:Number) {
        
        //getting local variables
        managedObject = target;
        xAxis = xpos;
        yAxis = ypos;
        
        //executing the actions
        setLayout();
        stage.addEventListener(Event.RESIZE, resizeListener);
        
    }
    
    private function resizeListener() {
        setLayout();            
    }
    
    private function setLayout() {
        managedObject.x = xAxis;
        managedObject.y = yAxis;
    }
    
}

```

}[/AS]

And when I test my movie, everything works correctly, though I get this in the Output window:

```auto
TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at com.placement::LiquidLayout$iinit()
    at test_fla::MainTimeline/test_fla::frame1()

```

Can anyone explain, why this happens, and how I should fix the class file to have no such warnings in the future.

Thanks in advance, Here are the source files:
