Accessing Variables from other classes ERROR 1009

Hello, I am having this issue were I can not access any variables from any other class!

:frowning:


package com.ironcoding.game
{
    import com.ironcoding.game.content.heroes.BugChar;
    import com.ironcoding.game.engine.GameClient;
    import com.ironcoding.game.engine.GameEvent;
    import com.ironcoding.game.RPGText;

    import flash.display.MovieClip;
    
    /**
     *
     * Document class.
     *
     */

    public class OurGame extends MovieClip
    {
        protected var textBlocks:Array = new Array(
        [,"Hey there, Press X to continue"],
        [,"How is it going?"],
        [,"Press X while this text is typing out too skip the whole text part see watch .........................."],
        [,"Did it work?"],
        [,"Well thats about it..."]
           );
        public var _finishedText:Boolean = false;
        protected const TILESETS_URL:String = "com/ironcoding/game/content/tilesets3.json";
        protected const MAPS_URL:String = "com/ironcoding/game/content/maps3.json";
        protected const TILE_WIDTH:int = 32;
        protected const TILE_HEIGHT:int = 32;
        protected const GRAVITY:Number = 1;
        protected const TILT_RATIO:Number = .9;
        protected const STRAFING:Boolean = true;

        protected var _gameClient:GameClient;
        public function OurGame()
        {
            this._gameClient = new GameClient(TILESETS_URL,MAPS_URL,TILE_WIDTH,TILE_HEIGHT,GRAVITY,TILT_RATIO,STRAFING);
            this.addChild(this._gameClient);
            this._gameClient.addEventListener(GameEvent.GAME_LOADED, this.initGame);
        }

        /**
         * 
         * Initializes the game after it is loaded.
         * 
         */

        protected function initGame(event:GameEvent):void
        {
            this._gameClient.loadMap(0);
            this._gameClient.addHero(BugChar,15,6, 0, 1, true);
            setChildIndex(rpgText,numChildren-1);
            rpgText.textBlocks=textBlocks;
            rpgText.startText();
            rpgText.visible = true;
        }
        
    }
}
 

Now im trying to access that variable from a different class, but it gives me an error of

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.ironcoding.game::RPGText/finishTextBlock()

and under RPGText Class

I have this,


package com.ironcoding.game{

    import flash.events.Event;
    import flash.text.*;
    import flash.display.MovieClip;
    import flash.events.KeyboardEvent;
    
    import com.ironcoding.game.OurGame;

    import flash.media.Sound;

    public class RPGText extends MovieClip {

        private const SPEAKER:int=0;
        private const TEXT:int=1;

        private var _currentTextBlockIndex:int=0;
        private var _currentTextBlock:String;
        private var _textBlocks:Array;
    
        public var _OG:OurGame;
        // CONSTRUCTOR
        public function RPGText() {

        }

        public function set textBlocks(txt:Array):void {
            _textBlocks=txt;
        }

        public function startText():void {
            _currentTextBlock=_textBlocks[_currentTextBlockIndex][TEXT];
            addEventListener(Event.ENTER_FRAME, updateText);
            addEventListener(KeyboardEvent.KEY_DOWN, fillText);
        }

        private function updateText(e:Event):void {
            
            if (txt.text.length<_currentTextBlock.length) {
                txt.text=_currentTextBlock.substr(0,txt.text.length+1);
            } else {
                removeEventListener(Event.ENTER_FRAME, updateText);
                fillText();
            }
        }

        private function fillText(event:KeyboardEvent = null):void {
            txt.text=_currentTextBlock;
            if (_currentTextBlockIndex<_textBlocks.length-1) {
                addEventListener(KeyboardEvent.KEY_DOWN, nextTextBlock);
            } else {
                addEventListener(KeyboardEvent.KEY_DOWN, finishTextBlock);
            }
        }

        private function nextTextBlock(event:KeyboardEvent):void {
            if (event.keyCode==88) {
                removeEventListener(KeyboardEvent.KEY_DOWN, nextTextBlock);
                txt.text="";// clear the text
                _currentTextBlockIndex++;
                _currentTextBlock =_textBlocks[_currentTextBlockIndex][TEXT];// set the text
                addEventListener(Event.ENTER_FRAME, updateText);// start updating the text
                addEventListener(KeyboardEvent.KEY_DOWN, fillText);
            } else {
                null;
            }
        }
        private function finishTextBlock(event:KeyboardEvent):void {
            removeEventListener(KeyboardEvent.KEY_DOWN, nextTextBlock);
            trace("DONE");
            this.visible = false;
            _OG._finishedText = true;
        }
    }
}

Now, from my other variables, that is what I do, I don’t understand what I am doing wrong?

Help!! please!

EDIT: Sorry I am Trying to acces _finishedText in RPG Class from my Main Class (OurGame Class).