fix script samples error with controlButton

This commit is contained in:
fanli 2015-12-19 22:03:37 +08:00
parent ef3bb81be6
commit ffbac99dc5
3 changed files with 17 additions and 9 deletions

View File

@ -32,17 +32,25 @@ jsb.EventListenerAssetsManager.prototype._ctor = function(assetsManager, callbac
cc.ControlButton.prototype._ctor = function(label, backgroundSprite, fontSize){
if(fontSize != undefined)
this.initWithTitleAndFontNameAndFontSize(label, backgroundSprite, fontSize);
else if(backgroundSprite != undefined)
this.initWithLabelAndBackgroundSprite(label, backgroundSprite);
else if(label != undefined)
cc.ControlButton.prototype._ctor = function(label, backgroundSprite, fontSize, fontName, autoSizeWithLabel ){
if (autoSizeWithLabel !== undefined && backgroundSprite) {
this.initWithLabelAndBackgroundSprite(label, backgroundSprite, autoSizeWithLabel);
}
else if(fontName !== undefined && fontSize !== undefined) {
this.initWithTitleAndFontNameAndFontSize(label, fontName, fontSize);
}
else if(backgroundSprite !== undefined) {
this.initWithLabelAndBackgroundSprite(label, backgroundSprite, true);
}
else if(label !== undefined) {
this.initWithBackgroundSprite(label);
else
}
else {
this.init();
}
};
cc.ControlColourPicker.prototype._ctor = function(){
this.init();
};

View File

@ -264,7 +264,7 @@ var ControlButtonTest_Styling = ControlScene.extend({
titleButton.color = cc.color(159, 168, 176);
var button = new cc.ControlButton(titleButton, backgroundButton);
var button = new cc.ControlButton(titleButton, backgroundButton, null, null, false);
button.setBackgroundSpriteForState(backgroundHighlightedButton, cc.CONTROL_STATE_HIGHLIGHTED);
button.setTitleColorForState(cc.color.WHITE, cc.CONTROL_STATE_HIGHLIGHTED);

View File

@ -591,7 +591,7 @@ local function runCCControlTest()
pTitleButton:setColor(cc.c3b(159, 168, 176))
local pButton = cc.ControlButton:create(pTitleButton, pBackgroundButton)
local pButton = cc.ControlButton:create(pTitleButton, pBackgroundButton,false)
pButton:setBackgroundSpriteForState(pBackgroundHighlightedButton, cc.CONTROL_STATE_HIGH_LIGHTED )
pButton:setTitleColorForState(cc.c3b(255,255,255), cc.CONTROL_STATE_HIGH_LIGHTED )