富文本控件的问题

请教下,富文本控件怎么用,我创建了一个图片的元素,但是在添加的时候报错了,Uncaught TypeError: Cannot read property ‘_type’ of undefined

var richText = new ccui.RichText();
richText.ignoreContentAdaptWithSize(false);
richText.width = 300;
richText.height = 400;
richText.setPosition(cc.p(500, 300));

this.addChild(richText);

var img = ccui.RichElementImage(3, cc.color.WHITE, 255, res.img);
richText.pushBackElement(img);

这样写不对么?:12:

创建RichElementImage写错了!!
var img =new ccui.RichElementImage(3, cc.color.WHITE, 255, res.img);

好吧 谢了 我表示我有傻X了一次