# Parent to Child as3

**URL:** https://forum.kirupa.com/t/parent-to-child-as3/304404
**Category:** flash
**Created:** [February 7, 2010, 1:23pm UTC](https://forum.kirupa.com/t/parent-to-child-as3/304404 "2010-02-07T13:23:34Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![dillpickle102](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@dillpickle102](https://forum.kirupa.com/u/dillpickle102)
#### Post date: [February 7, 2010, 1:23pm UTC](https://forum.kirupa.com/t/parent-to-child-as3/304404/1 "2010-02-07T13:23:34Z")

</div>

Alright this problem is driving me MAD!!!

So I’m trying to get a child class to access an array from the parent class.

I even told the compiler it’s a Movie Clip and it’s still being mean.

## Here’s the code

package as3  
{  
import flash.display.MovieClip;  
import flash.display.Stage;  
import flash.events.Event

public class Circle extends MovieClip  
{  
var xPosArray:Array  
var yPosArray:Array  
public function Circle()  
{  
this.addEventListener(Event.ADDED\_TO\_STAGE,initFunction);

}

public function initFunction(evt:Event)  
{

xPosArray = MovieClip(this.parent.parent).xPosArray  
yPosArray = MovieClip(this.parent.parent).yPosArray  
}  
}  
}

* * *

It returns this:

TypeError: Error #1009: Cannot access a property or method of a null object reference.  
at as3::Circle/initFunction()  
at flash.display::DisplayObjectContainer/addChild()  
at flash.display::Stage/addChild()  
at as3::Fdotty()  
at as3::Engine()
