Derek Chow
Villager
- Xy$
- 0.00
Hello I am a programmer, but being the first time using javascript i get an error which i never seen before in other languages.
To start off i made my own window which works fine, now i want to for loop through an array to draw progress bars.
unlockablesWindow.prototype.initialize = function(x,y){
Window_Base.prototype.initialize.call(this,x,y,Graphics.boxWidth,Graphics.boxHeight);
for(var i = 0; i < achievementText.length; i++){
unlockablesWindow.prototype.createVariableBars(i);
}
unlockablesWindow.prototype.createVariableBars = function(x){
var lineheight = this.lineHeight;
this._variableBar = new Sprite();
this._variableBar.x = 0;
this._variableBar.y = lineheight*x;
var variableBarWidth = Graphics.boxWidth-50;
var variableBarHeight = 30;
this.addChild(this._variableBar);
this.drawText(achievementText[x],0,lineheight*x,Graphics.boxWidth/3,'left');
this._variableBar.bitmap = new Bitmap(variableBarWidth,variableBarHeight);
this._variableBar.bitmap.fillAll('white');
}
The error on the function createVariableBars and the error is on addchild
Cannot read property 'length' of undefined
at unlockablesWindow.PIXI.DisplayObjectContainer.addChild (pixi.js:1903)
I checked pixi, but i do not understand js enough to debug it . Any help is appreciated Thanks.
To start off i made my own window which works fine, now i want to for loop through an array to draw progress bars.
unlockablesWindow.prototype.initialize = function(x,y){
Window_Base.prototype.initialize.call(this,x,y,Graphics.boxWidth,Graphics.boxHeight);
for(var i = 0; i < achievementText.length; i++){
unlockablesWindow.prototype.createVariableBars(i);
}
unlockablesWindow.prototype.createVariableBars = function(x){
var lineheight = this.lineHeight;
this._variableBar = new Sprite();
this._variableBar.x = 0;
this._variableBar.y = lineheight*x;
var variableBarWidth = Graphics.boxWidth-50;
var variableBarHeight = 30;
this.addChild(this._variableBar);
this.drawText(achievementText[x],0,lineheight*x,Graphics.boxWidth/3,'left');
this._variableBar.bitmap = new Bitmap(variableBarWidth,variableBarHeight);
this._variableBar.bitmap.fillAll('white');
}
The error on the function createVariableBars and the error is on addchild
Cannot read property 'length' of undefined
at unlockablesWindow.PIXI.DisplayObjectContainer.addChild (pixi.js:1903)
I checked pixi, but i do not understand js enough to debug it . Any help is appreciated Thanks.