@@ -49,14 +49,14 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
4949 _capInsetsNormal : null ,
5050 _capInsetsPressed : null ,
5151 _capInsetsDisabled : null ,
52- _normalTexType : null ,
53- _pressedTexType : null ,
54- _disabledTexType : null ,
52+ _normalTexType : ccui . Widget . LOCAL_TEXTURE ,
53+ _pressedTexType : ccui . Widget . LOCAL_TEXTURE ,
54+ _disabledTexType : ccui . Widget . LOCAL_TEXTURE ,
5555 _normalTextureSize : null ,
5656 _pressedTextureSize : null ,
5757 _disabledTextureSize : null ,
5858 pressedActionEnabled : false ,
59- _titleColor : null ,
59+ _titleColor : cc . color . WHITE ,
6060 _normalTextureScaleXInSize : 1 ,
6161 _normalTextureScaleYInSize : 1 ,
6262 _pressedTextureScaleXInSize : 1 ,
@@ -65,36 +65,24 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
6565 _pressedTextureLoaded : false ,
6666 _disabledTextureLoaded : false ,
6767 _className : "Button" ,
68+
69+ /**
70+ * allocates and initializes a UIButton.
71+ * @constructor
72+ * @example
73+ * // example
74+ * var uiButton = new ccui.Button();
75+ */
6876 ctor : function ( ) {
69- ccui . Widget . prototype . ctor . call ( this ) ;
70- this . _buttonNormalRenderer = null ;
71- this . _buttonClickedRenderer = null ;
72- this . _buttonDisableRenderer = null ;
73- this . _titleRenderer = null ;
74- this . _normalFileName = "" ;
75- this . _clickedFileName = "" ;
76- this . _disabledFileName = "" ;
77- this . _prevIgnoreSize = true ;
78- this . _scale9Enabled = false ;
7977 this . _capInsetsNormal = cc . rect ( 0 , 0 , 0 , 0 ) ;
8078 this . _capInsetsPressed = cc . rect ( 0 , 0 , 0 , 0 ) ;
8179 this . _capInsetsDisabled = cc . rect ( 0 , 0 , 0 , 0 ) ;
82- this . _normalTexType = ccui . Widget . LOCAL_TEXTURE ;
83- this . _pressedTexType = ccui . Widget . LOCAL_TEXTURE ;
84- this . _disabledTexType = ccui . Widget . LOCAL_TEXTURE ;
8580 var locSize = this . _size ;
8681 this . _normalTextureSize = cc . size ( locSize . width , locSize . height ) ;
8782 this . _pressedTextureSize = cc . size ( locSize . width , locSize . height ) ;
8883 this . _disabledTextureSize = cc . size ( locSize . width , locSize . height ) ;
89- this . pressedActionEnabled = false ;
90- this . _titleColor = cc . color . WHITE ;
91- this . _normalTextureScaleXInSize = 1 ;
92- this . _normalTextureScaleYInSize = 1 ;
93- this . _pressedTextureScaleXInSize = 1 ;
94- this . _pressedTextureScaleYInSize = 1 ;
95- this . _normalTextureLoaded = false ;
96- this . _pressedTextureLoaded = false ;
97- this . _disabledTextureLoaded = false ;
84+
85+ ccui . Widget . prototype . ctor . call ( this ) ;
9886 } ,
9987
10088 init : function ( ) {
@@ -821,11 +809,7 @@ _p = null;
821809 * var uiButton = ccui.Button.create();
822810 */
823811ccui . Button . create = function ( ) {
824- var uiButton = new ccui . Button ( ) ;
825- if ( uiButton && uiButton . init ( ) ) {
826- return uiButton ;
827- }
828- return null ;
812+ return new ccui . Button ;
829813} ;
830814
831815// Constants
0 commit comments