tmp = cc.textureCache.addImage(share_tencentweibo_png);
this.m_pShareTencentWeiboButton =
new cc.ControlButton();
this.m_pShareTencentWeiboButton.setBackgroundSpriteForState(
new cc.Scale9Sprite(share_tencentweibo_png), cc.CONTROL_STATE_NORMAL);
this.m_pShareTencentWeiboButton.setPreferredSize(tmp.getContentSize());
this.m_pShareTencentWeiboButton.setAnchorPoint(cc.p(0.5, 0.5));
this.ptTencentWeibo = cc.p(
this.m_pShareWeixinButton.getPositionX() - tmp.getContentSize().width - button_spilt, btnPosY);
this.m_pShareTencentWeiboButton.setPosition(
this.ptTencentWeibo);
this.m_pShareTencentWeiboButton.addTargetWithActionForControlEvents(
this,
this.ButtonClick, cc.CONTROL_EVENT_TOUCH_UP_INSIDE);
this.pBgLayer.addChild(
this.m_pShareTencentWeiboButton, SHARE_TENCENTWEIBO_ZORDER);
tmp = cc.textureCache.addImage(share_sinaweibo_png);
this.m_pShareSinaWeiboButton =
new cc.ControlButton();
this.m_pShareSinaWeiboButton.setBackgroundSpriteForState(
new cc.Scale9Sprite(share_sinaweibo_png), cc.CONTROL_STATE_NORMAL);
this.m_pShareSinaWeiboButton.setPreferredSize(tmp.getContentSize());
this.m_pShareSinaWeiboButton.setAnchorPoint(cc.p(0.5, 0.5));
this.ptSinaWeibo = cc.p(
this.m_pShareTencentWeiboButton.getPositionX() - tmp.getContentSize().width - button_spilt, btnPosY);
this.m_pShareSinaWeiboButton.setPosition(
this.ptSinaWeibo);
this.m_pShareSinaWeiboButton.addTargetWithActionForControlEvents(
this,
this.ButtonClick, cc.CONTROL_EVENT_TOUCH_UP_INSIDE);
this.pBgLayer.addChild(
this.m_pShareSinaWeiboButton, SHARE_SINAWEIBO_ZORDER);
创建的两个cc.ControlButton,都赋予
this.ButtonClick,为什么只有第一个cc.ControlButton可以回调
this.ButtonClick,第二个不可以;把上面的两个按钮调换顺序后,也是只有第一个可以回调
this.ButtonClick