var Hero_EXP = ccui.helper.seekWidgetByName(layout, “Image_8”);
Hero_EXP.setTexture(res.log_roger_png);
报错是 Hero_EXP.setTexture is not a function
求解
var Hero_EXP = ccui.helper.seekWidgetByName(layout, “Image_8”);
Hero_EXP.setTexture(res.log_roger_png);
报错是 Hero_EXP.setTexture is not a function
求解
额 看样子你用的是imageview 你用的接口都不对肯定报错啊
好好去关注下js绑定的接口字符串名吧一般都会和c++中类的函数名相同的
imageview的替换纹理的函数是loadTexture
绑定方法代码如下
static JSFunctionSpec funcs] = {
JS_FN(“loadTexture”, js_cocos2dx_ui_ImageView_loadTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("_init", js_cocos2dx_ui_ImageView_init, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN(“setScale9Enabled”, js_cocos2dx_ui_ImageView_setScale9Enabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN(“setTextureRect”, js_cocos2dx_ui_ImageView_setTextureRect, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN(“setCapInsets”, js_cocos2dx_ui_ImageView_setCapInsets, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN(“getCapInsets”, js_cocos2dx_ui_ImageView_getCapInsets, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN(“isScale9Enabled”, js_cocos2dx_ui_ImageView_isScale9Enabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN(“ctor”, js_cocos2d_ui_ImageView_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};