@tonywowo 写道:
cocosCreator 如何先执行基类onLoad方法再执行子类的onLoad方法
试了用this._super没用//基类
var MsgBase = require('./MsgBase');
cc.Class({
extends: MsgBase,
properties: {
// maskPrefabs : {
// default:null,
// type:cc.Prefab,
// }
},// use this for initialization onLoad: function () { cc.log( 'MsgMask - onLoad' ); },
});
//子类
var MsgMask = require('./../MsgMask');
var MsgSet = cc.Class({
extends:MsgMask,
onLoad:function() {
cc.log( 'MsgSet - onLoad' );
//this._super.onLoad();
},
});//创建弹框
MsgSet.Create = function()
{
cc.loader.loadRes('prefabs/msg/MsgSet',function(err,prefab){
cc.log('err %s ',err);
var maskNode = cc.instantiate(prefab);
cc.director.getScene().addChild( maskNode );
});
};
帖子: 2
参与者: 1