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

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.


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++;
    }