@@ -278,24 +278,19 @@ ccui.Scale9Sprite = cc.Scale9Sprite = cc.Node.extend(/** @lends ccui.Scale9Sprit
278278
279279 /** Opacity: conforms to CCRGBAProtocol protocol */
280280 setOpacity : function ( opacity ) {
281- if ( ! this . _scale9Image )
282- return ;
283281 cc . Node . prototype . setOpacity . call ( this , opacity ) ;
284282 if ( this . _scale9Enabled ) {
285283 var pChildren = this . _renderers ;
286284 for ( var i = 0 ; i < pChildren . length ; i ++ )
287285 pChildren [ i ] . setOpacity ( opacity ) ;
288286 }
289- else
287+ else if ( this . _scale9Image )
290288 this . _scale9Image . setOpacity ( opacity ) ;
291289 this . _scale9Dirty = true ;
292290 } ,
293291
294292 /** Color: conforms to CCRGBAProtocol protocol */
295293 setColor : function ( color ) {
296- if ( ! this . _scale9Image )
297- return ;
298-
299294 cc . Node . prototype . setColor . call ( this , color ) ;
300295 if ( this . _scale9Enabled ) {
301296 var scaleChildren = this . _renderers ;
@@ -305,7 +300,7 @@ ccui.Scale9Sprite = cc.Scale9Sprite = cc.Node.extend(/** @lends ccui.Scale9Sprit
305300 selChild . setColor ( color ) ;
306301 }
307302 }
308- else
303+ else if ( this . _scale9Image )
309304 this . _scale9Image . setColor ( color ) ;
310305 this . _scale9Dirty = true ;
311306 } ,
@@ -501,6 +496,7 @@ ccui.Scale9Sprite = cc.Scale9Sprite = cc.Node.extend(/** @lends ccui.Scale9Sprit
501496 this . updateWithBatchNode ( this . _scale9Image , cc . rect ( 0 , 0 , size . width , size . height ) , false , this . _capInsets ) ;
502497 if ( restorePreferredSize ) this . setPreferredSize ( preferredSize ) ;
503498 this . _positionsAreDirty = true ;
499+ this . setNodeDirty ( ) ;
504500 this . dispatchEvent ( "load" ) ;
505501 } , this ) ;
506502 }
@@ -533,6 +529,7 @@ ccui.Scale9Sprite = cc.Scale9Sprite = cc.Node.extend(/** @lends ccui.Scale9Sprit
533529 this . updateWithBatchNode ( this . _scale9Image , sender . getRect ( ) , cc . _renderType === cc . game . RENDER_TYPE_WEBGL && sender . isRotated ( ) , this . _capInsets ) ;
534530 if ( restorePreferredSize ) this . setPreferredSize ( preferredSize ) ;
535531 this . _positionsAreDirty = true ;
532+ this . setNodeDirty ( ) ;
536533 this . dispatchEvent ( "load" ) ;
537534 } , this ) ;
538535 }
@@ -863,6 +860,7 @@ ccui.Scale9Sprite = cc.Scale9Sprite = cc.Node.extend(/** @lends ccui.Scale9Sprit
863860 this . _positionsAreDirty = true ;
864861 this . updateWithSprite ( sprite , spriteRect , spriteFrameRotated , offset , originalSize , capInsets ) ;
865862 this . setVisible ( true ) ;
863+ this . setNodeDirty ( ) ;
866864 this . dispatchEvent ( "load" ) ;
867865 } , this ) ;
868866 this . setVisible ( false ) ;
@@ -916,6 +914,7 @@ ccui.Scale9Sprite = cc.Scale9Sprite = cc.Node.extend(/** @lends ccui.Scale9Sprit
916914 this . _positionsAreDirty = true ;
917915 this . updateWithBatchNode ( batchNode , originalRect , rotated , capInsets ) ;
918916 this . setVisible ( true ) ;
917+ this . setNodeDirty ( ) ;
919918 this . dispatchEvent ( "load" ) ;
920919 } , this ) ;
921920 this . setVisible ( false ) ;
@@ -941,6 +940,7 @@ ccui.Scale9Sprite = cc.Scale9Sprite = cc.Node.extend(/** @lends ccui.Scale9Sprit
941940 this . updateWithBatchNode ( this . _scale9Image , sender . getRect ( ) , cc . _renderType === cc . game . RENDER_TYPE_WEBGL && sender . isRotated ( ) , this . _capInsets ) ;
942941 if ( restorePreferredSize ) this . setPreferredSize ( preferredSize ) ;
943942 this . _positionsAreDirty = true ;
943+ this . setNodeDirty ( ) ;
944944 this . dispatchEvent ( "load" ) ;
945945 } , this ) ;
946946 }
0 commit comments