[英]Can't access member data Three.js TypeScript
I'm using three.d.ts from DefinitelyTyped and TypeScript. 我正在使用来自DefinitelyTyped和TypeScript的three.d.ts。 I have the following code
我有以下代码
class WoodStyle extends THREE.MeshBasicMaterial{
putTexture(image: any){
super.map=image;
}
constructor(){
LoadImage().then(putTexture);
super();
}
}
In which I load an image and then I update the material with the new image. 在其中加载图像,然后使用新图像更新材质。 But when I'm trying to compile the code it shows an error:
2340 Only public and protected methods of the base class are accessible via the 'super' keyword
. 但是,当我尝试编译代码时,它显示了一个错误:
2340 Only public and protected methods of the base class are accessible via the 'super' keyword
。 What I'm doing wrong? 我做错了什么?
When accessing an inherited property, use this
: 访问继承的属性时,请使用
this
:
class WoodStyle extends THREE.MeshBasicMaterial{
putTexture(image: any){
this.map=image;
}
constructor(){
LoadImage().then(putTexture);
super();
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.