RMMV TypeError: Cannot read property 'parent' of undefined

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
5,688
Reaction score
2,241
First Language
Dutch
Primarily Uses
RMMV
Hi community

I get this weird error as it worked before (see image).
TypeError_Parent.png

and when I change this "addChild" outside the update functions it works, but this part worked before.
JavaScript:
    Window_Message.prototype.createMessageBoxName = function(name) {
        this._tBoxName = new Window_MessageBoxName(name);
        this.updateOpen();
        //this.addChild(this._tBoxName);
    };

    Window_Message.prototype.updateOpen = function() {
        if (this._opening) {
            this.openness += 32;
            if (this.isOpen()) {
                this._opening = false;
                this.addChild(this._tBoxName);
            }
        }
    };

I do not know why it doesn't work now, while it worked previousely.
Another not what is weird that the text starts BLACK as all text start of WHITE, this is only the first
line of text popping up.

as updateOpen does NOT exist in the window_Message, I needed to create that function in order
to work it correctly with it's name showing.
Otherwise, it shows up before the window was open.

does anyone knows a fix for this and why it happends?

EDIT:
As for the type error, I made 2 additional checks to get rid of it, but I dont
understand why the black text is given somehow as nowhere is set this part.
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,658
Reaction score
2,749
First Language
EN
Primarily Uses
RMMZ
That error implies this._tBoxName is not defined when passing it to addChild. All game windows possess an updateOpen method, inherited from Window_Base and invoked via Window_Base#update. So updateOpen will probably be called before you invoke your createMessageBoxName method.

A game window's text colour is typically set via createContents, which is called from Window_Base#initialize. Check your window's initialize method.
 

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
5,688
Reaction score
2,241
First Language
Dutch
Primarily Uses
RMMV
I didn't add any methode of changing the text color, as the window skin
first color (0) is white, and reset it back.

why it starts with black color is unknown, as the namebox is fixed
with 2 additionals checks to get it away as it was working before.

some functions are overwritten, but didn't mess with text colors
except on the name and resetFontColor, but they are both set to 0.

it does that only by the 1st event I use that, if I re-open the action
on the same NPC, it works as it should.

as well, I didn't touch any createContents of the window_Base initiliaze.
 

Latest Threads

Latest Profile Posts

Suddenly, games mean nothing. The money spent was worth it to bring souls towards the light of life. May God bless my path forever. I pray that all are shaken for truth and poured out flat on the table of true understanding, knowledge, and wisdom. Bless you.
Finally I bought OMORI...cant wait to get traumatised!!!
Finished making this pretty ambitious forest map. Was wondering what y'all think of it! :kaopride:
1656136876015.png
All this anger everywhere,Who's happy but me?
Seems to be all the people that don't follow Jesus wholeheartedly. My smile might burn you ahhhhhhhhhhh!
Zoom in for cut-scenes and the like? Yay or Nay?

Forum statistics

Threads
123,020
Messages
1,153,442
Members
161,362
Latest member
Dthwithdoom
Top