出现这种问题是什么情况?都是按教程来的

The “type” attribute of “touxiang.lbn” is undefined when loading script.

cc.Class({
extends: cc.Component,

properties: {
    lbn:{
        default:null,
        type:cc.Lable
    },
    touxiang:{
        default:null,
        type:cc.Sprite
    },
    tupian:{
        default:[],
        type:cc.SpriteFrame
    }
},
onLoad: function () {
    function gettouxiang(min,max){
    var ma=cc.random0to1();
    return min+Math.floor((max-min)*ma);
    }
    var maa=gettouxiang(1,this.tupian.lenth);
    this.lbn.String=maa.toString();
    this.touxiang.SpriteFrame=tupian[maa];
},

});

lbn:{
default:null,
type:cc.Lable --》 拼写错误
},

1赞

谢谢~虽然我依然看不出来哪个字打错了,但是重新打了一遍就好了,果然是字打错了