# TypeError: Error #1009: Cannot access a property or method of a null object reference

**URL:** <https://forum.kirupa.com/t/typeerror-error-1009-cannot-access-a-property-or-method-of-a-null-object-reference/277605>\
**Category:** Uncategorized\
**Created:** [December 14, 2008, 7:42pm UTC](https://forum.kirupa.com/t/typeerror-error-1009-cannot-access-a-property-or-method-of-a-null-object-reference/277605 "2008-12-14T19:42:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andriusain](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andriusain](https://forum.kirupa.com/u/andriusain)\
**Post date:** [December 14, 2008, 7:42pm UTC](https://forum.kirupa.com/t/typeerror-error-1009-cannot-access-a-property-or-method-of-a-null-object-reference/277605/1 "2008-12-14T19:42:58Z")

</div>

Hello all I have a slight problem here which I guess it would be simple to solve but I need here your help because I am not able to figure it out for much that I try.

On my third line of code you can see a reference to a text field that gets loaded with some text retrieved from an XML file. There is a button “nextButton\_mc”, which will call a function that should retrieve the pertinent text from the next node in that XML. All code works fine except for the reference I make to that text field inside the nextSlides function. I do not know why it would not work with the same reference I made before: MovieClip(this.parent).myText.text

When I press the button that should retrieve the next piece of text I get this error: TypeError: Error #1009: Cannot access a property or method of a null object reference.

Obviously I am doing something wrong here.

I am very grateful for any help from you.

Andres.

```php

function linkEvent(evt:TextEvent):void {

    linkText.removeEventListener(TextEvent.LINK, linkEvent);

MovieClip(this.parent).myText.text=projectsXML.item[Number(evt.text)].desc;

    nextButton_mc.addEventListener(MouseEvent.CLICK, nextSlides);

    var index=[Number(evt.text)+1];

    function nextSlides(e:MouseEvent) {
        if (index<projectsXML.item.length()) {
MovieClip(this.parent).myText.text=projectsXML.item[index].desc;        
              } 

        index++;
    }

```
