I'm working with PixiJS but my question is very general. I created a constructor (1) and within that constructor (1) I call another constructor (2). I now need to access some methods of constructor (2) from the constructor (1) but I alway get the output 'Cannot read property 'renderer' of undefined'. What am I doing wrong?
Call constructor 1 and it's method 'animate':
stage3 = new site3();
requestAnimationFrame(stage3.animate);
Constructor 1:
function site3() {
this.fullstage = new fullscreenstage("intimg");
this.snowfrontblur = new PIXI.BlurFilter();
this.snowfrontblur.blurX = 5;
this.snowfrontblur.blurY = 5;
this.snowfront = SpriteFromImage("resources/img/snow.png",0,0,0.5,0.5);
this.fullstage.stage.addChild(this.snowfront);
this.snowfront.filters = [this.snowfrontblur];
}
site3.prototype.animate = function() {
this.fullstage.renderer.render(this.fullstage.stage);
requestAnimationFrame(this.animate);
};
Constructor 2:
function fullscreenstage(cavansid){
this.renderer = new PIXI.WebGLRenderer(ww, wh, null, true);
document.getElementById(cavansid).appendChild(this.renderer.view);
this.interactive = true;
this.stage = new PIXI.Stage(0x000000, this.interactive);
}