[Flash CS3] Little big OOP problem?!

Hi all,

i have little problem with AS3. I hope somebody will help me.

I create main movieClip “mainMC”. In this movieClip i’ll create two movieClips “frame1MC” and “frame2MC” each at own frame (frame1MC at frame 1 and frame2MC at frame 2). Both frames have stop(); in actions layer.

Than in movieClip “frame2MC” (at frame 2) i’ll create textField with instance name Txt.

To mainMC clip in library i’ll link class mainMC.

package {
import flash.events.;
import flash.display.
;
import flash.text.*;

public class mainMC extends MovieClip {
private var count:Number = 0;

public function mainMC() {
this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
}

public function onEnterFrame(e:Event):void {
count++;
if (count == 100) {
gotoNext(count);
}
}

public function gotoNext(count:Number):void {
this.nextFrame();
frame2MC.Txt.text = count;
}
}
}

And whats the problem? After count reach 100 gotoNext function will go to nextFrame and wanna insert some text. But it’ll do some error

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mainMC/gotoNext()
at mainMC/onEnterFrame()

whats the problem? can somebody help? same problem would be if i want to insert button to frame2MC which link back to frame 1 etc.:jail:

thx