openShares: function (event,CustomEventData) {
// 截图并保存后显示分享面板
var canvas = cc.director.getScene().getChildByName('Canvas');
var renderTexture = cc.RenderTexture.create(1136,640, cc.Texture2D.PIXEL_FORMAT_RGBA8888, gl.DEPTH24_STENCIL8_OES);
canvas._sgNode.addChild(renderTexture);
renderTexture.setVisible(false);
// var renderTexture = cc.RenderTexture.create(1136,640);
renderTexture.begin();
canvas._sgNode.visit();
// this.pnlFinal.getChildByName("resultPanel")._sgNode.visit();
renderTexture.end();
var that = this;
renderTexture.saveToFile("screenShot.png",cc.ImageFormat.PNG,true,function(){
renderTexture.removeFromParent();
console.log("截图成功截图成功截图成功截图成功截图成功截图成功截图成功截图成功");
var imgUrl = jsb.fileUtils.getWritablePath() + "screenShot.png";
// 安卓端调起截图分享
var ret = jsb.reflection.callStaticMethod(
"org/cocos2dx/javascript/AppActivity",
"shareScreenShot",
"(Ljava/lang/String;Ljava/lang/String;)V",
CustomEventData,
imgUrl
);
});
}