1 /****************************************************************************
  2  Copyright (c) 2011-2012 cocos2d-x.org
  3  Copyright (c) 2013-2014 Chukong Technologies Inc.
  4 
  5  http://www.cocos2d-x.org
  6 
  7  Permission is hereby granted, free of charge, to any person obtaining a copy
  8  of this software and associated documentation files (the "Software"), to deal
  9  in the Software without restriction, including without limitation the rights
 10  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 11  copies of the Software, and to permit persons to whom the Software is
 12  furnished to do so, subject to the following conditions:
 13 
 14  The above copyright notice and this permission notice shall be included in
 15  all copies or substantial portions of the Software.
 16 
 17  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 18  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 19  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 20  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 21  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 22  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 23  THE SOFTWARE.
 24  ****************************************************************************/
 25 
 26 /**
 27  * Base class for ccui.Slider
 28  * @class
 29  * @extends ccui.Widget
 30  *
 31  * @property {Number}   percent     - The current progress of loadingbar
 32  */
 33 ccui.Slider = ccui.Widget.extend(/** @lends ccui.Slider# */{
 34     _barRenderer: null,
 35     _progressBarRenderer: null,
 36     _progressBarTextureSize: null,
 37     _slidBallNormalRenderer: null,
 38     _slidBallPressedRenderer: null,
 39     _slidBallDisabledRenderer: null,
 40     _slidBallRenderer: null,
 41     _barLength: 0,
 42     _percent: 0,
 43     _scale9Enabled: false,
 44     _prevIgnoreSize: true,
 45     _textureFile: "",
 46     _progressBarTextureFile: "",
 47     _slidBallNormalTextureFile: "",
 48     _slidBallPressedTextureFile: "",
 49     _slidBallDisabledTextureFile: "",
 50     _capInsetsBarRenderer: null,
 51     _capInsetsProgressBarRenderer: null,
 52     _sliderEventListener: null,
 53     _sliderEventSelector: null,
 54     _barTexType: ccui.Widget.LOCAL_TEXTURE,
 55     _progressBarTexType: ccui.Widget.LOCAL_TEXTURE,
 56     _ballNTexType: ccui.Widget.LOCAL_TEXTURE,
 57     _ballPTexType: ccui.Widget.LOCAL_TEXTURE,
 58     _ballDTexType: ccui.Widget.LOCAL_TEXTURE,
 59     _isTextureLoaded: false,
 60     _className: "Slider",
 61     /**
 62      * allocates and initializes a UISlider.
 63      * Constructor of ccui.Slider
 64      * @example
 65      * // example
 66      * var uiSlider = new ccui.Slider();
 67      */
 68     ctor: function () {
 69         this._progressBarTextureSize = cc.size(0, 0);
 70         this._capInsetsBarRenderer = cc.rect(0, 0, 0, 0);
 71         this._capInsetsProgressBarRenderer = cc.rect(0, 0, 0, 0);
 72         ccui.Widget.prototype.ctor.call(this);
 73     },
 74 
 75     init: function () {
 76         if (ccui.Widget.prototype.init.call(this)) {
 77             this.setTouchEnabled(true);
 78             return true;
 79         }
 80         return false;
 81     },
 82 
 83     initRenderer: function () {
 84         this._barRenderer = cc.Sprite.create();
 85         this._progressBarRenderer = cc.Sprite.create();
 86         this._progressBarRenderer.setAnchorPoint(0.0, 0.5);
 87         cc.Node.prototype.addChild.call(this, this._barRenderer, ccui.Slider.BASEBAR_RENDERER_ZORDER, -1);
 88         cc.Node.prototype.addChild.call(this, this._progressBarRenderer, ccui.Slider.PROGRESSBAR_RENDERER_ZORDER, -1);
 89         this._slidBallNormalRenderer = cc.Sprite.create();
 90         this._slidBallPressedRenderer = cc.Sprite.create();
 91         this._slidBallPressedRenderer.setVisible(false);
 92         this._slidBallDisabledRenderer = cc.Sprite.create();
 93         this._slidBallDisabledRenderer.setVisible(false);
 94         this._slidBallRenderer = cc.Node.create();
 95         this._slidBallRenderer.addChild(this._slidBallNormalRenderer);
 96         this._slidBallRenderer.addChild(this._slidBallPressedRenderer);
 97         this._slidBallRenderer.addChild(this._slidBallDisabledRenderer);
 98         cc.Node.prototype.addChild.call(this, this._slidBallRenderer, ccui.Slider.BALL_RENDERER_ZORDER, -1);
 99     },
100 
101     /**
102      * Load texture for slider bar.
103      * @param {String} fileName
104      * @param {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
105      */
106     loadBarTexture: function (fileName, texType) {
107         if (!fileName) {
108             return;
109         }
110         texType = texType || ccui.Widget.LOCAL_TEXTURE;
111         this._textureFile = fileName;
112         this._barTexType = texType;
113         var barRenderer = this._barRenderer;
114         switch (this._barTexType) {
115             case ccui.Widget.LOCAL_TEXTURE:
116                 barRenderer.initWithFile(fileName);
117                 break;
118             case ccui.Widget.PLIST_TEXTURE:
119                 barRenderer.initWithSpriteFrameName(fileName);
120                 break;
121             default:
122                 break;
123         }
124         this.updateColorToRenderer(barRenderer);
125         this.barRendererScaleChangedWithSize();
126 
127         if (!barRenderer.textureLoaded()) {
128             barRenderer.addLoadedEventListener(function () {
129                 this.barRendererScaleChangedWithSize();
130             }, this);
131         }
132     },
133 
134     /**
135      * Load dark state texture for slider progress bar.
136      * @param {String} fileName
137      * @param {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
138      */
139     loadProgressBarTexture: function (fileName, texType) {
140         if (!fileName) {
141             return;
142         }
143         texType = texType || ccui.Widget.LOCAL_TEXTURE;
144         this._progressBarTextureFile = fileName;
145         this._progressBarTexType = texType;
146         var progressBarRenderer = this._progressBarRenderer;
147         switch (this._progressBarTexType) {
148             case ccui.Widget.LOCAL_TEXTURE:
149                 progressBarRenderer.initWithFile(fileName);
150                 break;
151             case ccui.Widget.PLIST_TEXTURE:
152                 progressBarRenderer.initWithSpriteFrameName(fileName);
153                 break;
154             default:
155                 break;
156         }
157         this.updateColorToRenderer(progressBarRenderer);
158         progressBarRenderer.setAnchorPoint(0.0, 0.5);
159         var locSize = progressBarRenderer.getContentSize();
160         this._progressBarTextureSize.width = locSize.width;
161         this._progressBarTextureSize.height = locSize.height;
162         this.progressBarRendererScaleChangedWithSize();
163 
164         var textLoaded = progressBarRenderer.textureLoaded();
165         this._isTextureLoaded = textLoaded;
166         if (!textLoaded) {
167             progressBarRenderer.addLoadedEventListener(function () {
168                 this._isTextureLoaded = true;
169                 var locSize = progressBarRenderer.getContentSize();
170                 this._progressBarTextureSize.width = locSize.width;
171                 this._progressBarTextureSize.height = locSize.height;
172                 this.progressBarRendererScaleChangedWithSize();
173             }, this);
174         }
175     },
176 
177     /**
178      * Sets if slider is using scale9 renderer.
179      * @param {Boolean} able
180      */
181     setScale9Enabled: function (able) {
182         if (this._scale9Enabled == able) {
183             return;
184         }
185 
186         this._scale9Enabled = able;
187         cc.Node.prototype.removeChild.call(this, this._barRenderer, true);
188         cc.Node.prototype.removeChild.call(this, this._progressBarRenderer, true);
189         this._barRenderer = null;
190         this._progressBarRenderer = null;
191         if (this._scale9Enabled) {
192             this._barRenderer = cc.Scale9Sprite.create();
193             this._progressBarRenderer = cc.Scale9Sprite.create();
194         }
195         else {
196             this._barRenderer = cc.Sprite.create();
197             this._progressBarRenderer = cc.Sprite.create();
198         }
199         this.loadBarTexture(this._textureFile, this._barTexType);
200         this.loadProgressBarTexture(this._progressBarTextureFile, this._progressBarTexType);
201         cc.Node.prototype.addChild.call(this, this._barRenderer, ccui.Slider.BASEBAR_RENDERER_ZORDER, -1);
202         cc.Node.prototype.addChild.call(this, this._progressBarRenderer, ccui.Slider.PROGRESSBAR_RENDERER_ZORDER, -1);
203         if (this._scale9Enabled) {
204             var ignoreBefore = this._ignoreSize;
205             this.ignoreContentAdaptWithSize(false);
206             this._prevIgnoreSize = ignoreBefore;
207         }
208         else {
209             this.ignoreContentAdaptWithSize(this._prevIgnoreSize);
210         }
211         this.setCapInsetsBarRenderer(this._capInsetsBarRenderer);
212         this.setCapInsetProgressBarRenderer(this._capInsetsProgressBarRenderer);
213     },
214 
215     /**
216      * Get  slider is using scale9 renderer or not.
217      * @returns {Boolean}
218      */
219     isScale9Enabled: function () {
220         return this._scale9Enabled;
221     },
222 
223     /**
224      * override "ignoreContentAdaptWithSize" method of widget.
225      * @param {Boolean} ignore
226      */
227     ignoreContentAdaptWithSize: function (ignore) {
228         if (!this._scale9Enabled || (this._scale9Enabled && !ignore)) {
229             ccui.Widget.prototype.ignoreContentAdaptWithSize.call(this, ignore);
230             this._prevIgnoreSize = ignore;
231         }
232     },
233 
234     /**
235      * Sets capinsets for slider, if slider is using scale9 renderer.
236      * @param {cc.Rect} capInsets
237      */
238     setCapInsets: function (capInsets) {
239         this.setCapInsetsBarRenderer(capInsets);
240         this.setCapInsetProgressBarRenderer(capInsets);
241     },
242 
243     /**
244      * Sets capinsets for slider, if slider is using scale9 renderer.
245      * @param {cc.Rect} capInsets
246      */
247     setCapInsetsBarRenderer: function (capInsets) {
248         this._capInsetsBarRenderer = capInsets;
249         if (!this._scale9Enabled) {
250             return;
251         }
252         this._barRenderer.setCapInsets(capInsets);
253     },
254 
255     /**
256      * Get cap insets for slider.
257      * @returns {cc.Rect}
258      */
259     getCapInsetBarRenderer: function () {
260         return this._capInsetsBarRenderer;
261     },
262 
263     /**
264      * Sets capinsets for slider, if slider is using scale9 renderer.
265      * @param {cc.Rect} capInsets
266      */
267     setCapInsetProgressBarRenderer: function (capInsets) {
268         this._capInsetsProgressBarRenderer = capInsets;
269         if (!this._scale9Enabled) {
270             return;
271         }
272         this._progressBarRenderer.setCapInsets(capInsets);
273     },
274 
275     /**
276      * Get cap insets for slider.
277      * @returns {cc.Rect}
278      */
279     getCapInsetProgressBarRenderer: function () {
280         return this._capInsetsProgressBarRenderer;
281     },
282 
283     /**
284      * Load textures for slider ball.
285      * @param {String} normal
286      * @param {String} pressed
287      * @param {String} disabled
288      * @param {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
289      */
290     loadSlidBallTextures: function (normal, pressed, disabled, texType) {
291         this.loadSlidBallTextureNormal(normal, texType);
292         this.loadSlidBallTexturePressed(pressed, texType);
293         this.loadSlidBallTextureDisabled(disabled, texType);
294     },
295 
296     /**
297      * Load normal state texture for slider ball.
298      * @param {String} normal
299      * @param {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
300      */
301     loadSlidBallTextureNormal: function (normal, texType) {
302         if (!normal) {
303             return;
304         }
305         texType = texType || ccui.Widget.LOCAL_TEXTURE;
306         this._slidBallNormalTextureFile = normal;
307         this._ballNTexType = texType;
308         switch (this._ballNTexType) {
309             case ccui.Widget.LOCAL_TEXTURE:
310                 this._slidBallNormalRenderer.initWithFile(normal);
311                 break;
312             case ccui.Widget.PLIST_TEXTURE:
313                 this._slidBallNormalRenderer.initWithSpriteFrameName(normal);
314                 break;
315             default:
316                 break;
317         }
318         this.updateColorToRenderer(this._slidBallNormalRenderer);
319     },
320 
321     /**
322      * Load selected state texture for slider ball.
323      * @param {String} pressed
324      * @param {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
325      */
326     loadSlidBallTexturePressed: function (pressed, texType) {
327         if (!pressed) {
328             return;
329         }
330         texType = texType || ccui.Widget.LOCAL_TEXTURE;
331         this._slidBallPressedTextureFile = pressed;
332         this._ballPTexType = texType;
333         switch (this._ballPTexType) {
334             case ccui.Widget.LOCAL_TEXTURE:
335                 this._slidBallPressedRenderer.initWithFile(pressed);
336                 break;
337             case ccui.Widget.PLIST_TEXTURE:
338                 this._slidBallPressedRenderer.initWithSpriteFrameName(pressed);
339                 break;
340             default:
341                 break;
342         }
343         this.updateColorToRenderer(this._slidBallPressedRenderer);
344     },
345 
346     /**
347      * Load dark state texture for slider ball.
348      * @param {String} disabled
349      * @param {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
350      */
351     loadSlidBallTextureDisabled: function (disabled, texType) {
352         if (!disabled) {
353             return;
354         }
355         texType = texType || ccui.Widget.LOCAL_TEXTURE;
356         this._slidBallDisabledTextureFile = disabled;
357         this._ballDTexType = texType;
358         switch (this._ballDTexType) {
359             case ccui.Widget.LOCAL_TEXTURE:
360                 this._slidBallDisabledRenderer.initWithFile(disabled);
361                 break;
362             case ccui.Widget.PLIST_TEXTURE:
363                 this._slidBallDisabledRenderer.initWithSpriteFrameName(disabled);
364                 break;
365             default:
366                 break;
367         }
368         this.updateColorToRenderer(this._slidBallDisabledRenderer);
369     },
370 
371     /**
372      * Changes the progress direction of slider.
373      * @param {number} percent
374      */
375     setPercent: function (percent) {
376         if (percent > 100) {
377             percent = 100;
378         }
379         if (percent < 0) {
380             percent = 0;
381         }
382         this._percent = percent;
383         if (!this._isTextureLoaded) {
384             return;
385         }
386         var dis = this._barLength * (percent / 100.0);
387         this._slidBallRenderer.setPosition(-this._barLength / 2.0 + dis, 0.0);
388         if (this._scale9Enabled) {
389             this._progressBarRenderer.setPreferredSize(cc.size(dis, this._progressBarTextureSize.height));
390         }
391         else {
392             var x = 0, y = 0;
393             if (this._progressBarTexType == ccui.Widget.PLIST_TEXTURE) {
394                 var barNode = this._progressBarRenderer;
395                 if (barNode) {
396                     var rect = barNode.getTextureRect();
397                     x = rect.x;
398                     y = rect.y;
399                 }
400             }
401             this._progressBarRenderer.setTextureRect(cc.rect(x, y, this._progressBarTextureSize.width * (percent / 100.0), this._progressBarTextureSize.height));
402         }
403     },
404 
405     onTouchBegan: function (touch, event) {
406         var pass = ccui.Widget.prototype.onTouchBegan.call(this, touch, event);
407         if (this._hitted) {
408             var nsp = this.convertToNodeSpace(this._touchStartPos);
409             this.setPercent(this.getPercentWithBallPos(nsp.x));
410             this.percentChangedEvent();
411         }
412         return pass;
413     },
414 
415     onTouchMoved: function (touch, event) {
416         var touchPoint = touch.getLocation();
417         this._touchMovePos.x = touchPoint.x;
418         this._touchMovePos.y = touchPoint.y;
419         var nsp = this.convertToNodeSpace(touchPoint);
420         this._slidBallRenderer.setPosition(nsp.x, 0);
421         this.setPercent(this.getPercentWithBallPos(nsp.x));
422         this.percentChangedEvent();
423     },
424 
425     onTouchEnded: function (touch, event) {
426         ccui.Widget.prototype.onTouchEnded.call(this, touch, event);
427     },
428 
429     onTouchCancelled: function (touch, event) {
430         ccui.Widget.prototype.onTouchCancelled.call(this, touch, event);
431     },
432 
433     /**
434      * get percent with ballPos
435      * @param {cc.Point} px
436      * @returns {number}
437      */
438     getPercentWithBallPos: function (px) {
439         return (((px - (-this._barLength / 2.0)) / this._barLength) * 100.0);
440     },
441 
442     /**
443      * add event listener
444      * @param {Function} selector
445      * @param {Object} target
446      */
447     addEventListenerSlider: function (selector, target) {
448         this._sliderEventSelector = selector;
449         this._sliderEventListener = target;
450     },
451 
452     percentChangedEvent: function () {
453         if (this._sliderEventListener && this._sliderEventSelector) {
454             this._sliderEventSelector.call(this._sliderEventListener, this, ccui.Slider.EVENT_PERCENT_CHANGED);
455         }
456     },
457 
458     /**
459      * Gets the progress direction of slider.
460      * @returns {number}
461      */
462     getPercent: function () {
463         return this._percent;
464     },
465 
466     onSizeChanged: function () {
467         ccui.Widget.prototype.onSizeChanged.call(this);
468         this.barRendererScaleChangedWithSize();
469         this.progressBarRendererScaleChangedWithSize();
470     },
471 
472     /**
473      * override "getContentSize" method of widget.
474      * @returns {cc.Size}
475      */
476     getContentSize: function () {
477         var locContentSize = this._barRenderer.getContentSize();
478         return cc.size(locContentSize.width, locContentSize.height);
479     },
480     _getWidth: function () {
481         return this._barRenderer._getWidth();
482     },
483     _getHeight: function () {
484         return this._barRenderer._getHeight();
485     },
486 
487     /**
488      * override "getContentSize" method of widget.
489      * @returns {cc.Node}
490      */
491     getVirtualRenderer: function () {
492         return this._barRenderer;
493     },
494 
495     barRendererScaleChangedWithSize: function () {
496         if (this._ignoreSize) {
497             this._barRenderer.setScale(1.0);
498             var locSize = this._barRenderer.getContentSize();
499             this._size.width = locSize.width;
500             this._size.height = locSize.height;
501             this._barLength = locSize.width;
502         }
503         else {
504             this._barLength = this._size.width;
505             if (this._scale9Enabled) {
506                 this._barRenderer.setPreferredSize(cc.size(this._size.width, this._size.height));
507             }
508             else {
509                 var btextureSize = this._barRenderer.getContentSize();
510                 if (btextureSize.width <= 0.0 || btextureSize.height <= 0.0) {
511                     this._barRenderer.setScale(1.0);
512                     return;
513                 }
514                 var bscaleX = this._size.width / btextureSize.width;
515                 var bscaleY = this._size.height / btextureSize.height;
516                 this._barRenderer.setScaleX(bscaleX);
517                 this._barRenderer.setScaleY(bscaleY);
518             }
519         }
520         this.setPercent(this._percent);
521     },
522 
523     progressBarRendererScaleChangedWithSize: function () {
524         if (this._ignoreSize) {
525             if (!this._scale9Enabled) {
526                 var ptextureSize = this._progressBarTextureSize;
527                 var pscaleX = this._size.width / ptextureSize.width;
528                 var pscaleY = this._size.height / ptextureSize.height;
529                 this._progressBarRenderer.setScaleX(pscaleX);
530                 this._progressBarRenderer.setScaleY(pscaleY);
531             }
532         }
533         else {
534             if (this._scale9Enabled) {
535                 this._progressBarRenderer.setPreferredSize(cc.size(this._size.width, this._size.height));
536             }
537             else {
538                 var ptextureSize = this._progressBarTextureSize;
539                 if (ptextureSize.width <= 0.0 || ptextureSize.height <= 0.0) {
540                     this._progressBarRenderer.setScale(1.0);
541                     return;
542                 }
543                 var pscaleX = this._size.width / ptextureSize.width;
544                 var pscaleY = this._size.height / ptextureSize.height;
545                 this._progressBarRenderer.setScaleX(pscaleX);
546                 this._progressBarRenderer.setScaleY(pscaleY);
547             }
548         }
549         this._progressBarRenderer.setPosition(-this._barLength * 0.5, 0.0);
550         this.setPercent(this._percent);
551     },
552 
553     onPressStateChangedToNormal: function () {
554         this._slidBallNormalRenderer.setVisible(true);
555         this._slidBallPressedRenderer.setVisible(false);
556         this._slidBallDisabledRenderer.setVisible(false);
557     },
558 
559     onPressStateChangedToPressed: function () {
560         this._slidBallNormalRenderer.setVisible(false);
561         this._slidBallPressedRenderer.setVisible(true);
562         this._slidBallDisabledRenderer.setVisible(false);
563     },
564 
565     onPressStateChangedToDisabled: function () {
566         this._slidBallNormalRenderer.setVisible(false);
567         this._slidBallPressedRenderer.setVisible(false);
568         this._slidBallDisabledRenderer.setVisible(true);
569     },
570 
571     updateTextureColor: function () {
572         this.updateColorToRenderer(this._barRenderer);
573         this.updateColorToRenderer(this._progressBarRenderer);
574         this.updateColorToRenderer(this._slidBallNormalRenderer);
575         this.updateColorToRenderer(this._slidBallPressedRenderer);
576         this.updateColorToRenderer(this._slidBallDisabledRenderer);
577     },
578 
579     updateTextureOpacity: function () {
580         this.updateOpacityToRenderer(this._barRenderer);
581         this.updateOpacityToRenderer(this._progressBarRenderer);
582         this.updateOpacityToRenderer(this._slidBallNormalRenderer);
583         this.updateOpacityToRenderer(this._slidBallPressedRenderer);
584         this.updateOpacityToRenderer(this._slidBallDisabledRenderer);
585     },
586 
587     /**
588      * Returns the "class name" of widget.
589      * @returns {string}
590      */
591     getDescription: function () {
592         return "Slider";
593     },
594 
595     createCloneInstance: function () {
596         return ccui.Slider.create();
597     },
598 
599     copySpecialProperties: function (slider) {
600         this._prevIgnoreSize = slider._prevIgnoreSize;
601         this.setScale9Enabled(slider._scale9Enabled);
602         this.loadBarTexture(slider._textureFile, slider._barTexType);
603         this.loadProgressBarTexture(slider._progressBarTextureFile, slider._progressBarTexType);
604         this.loadSlidBallTextureNormal(slider._slidBallNormalTextureFile, slider._ballNTexType);
605         this.loadSlidBallTexturePressed(slider._slidBallPressedTextureFile, slider._ballPTexType);
606         this.loadSlidBallTextureDisabled(slider._slidBallDisabledTextureFile, slider._ballDTexType);
607         this.setPercent(slider.getPercent());
608     }
609 });
610 
611 var _p = ccui.Slider.prototype;
612 
613 // Extended properties
614 /** @expose */
615 _p.percent;
616 cc.defineGetterSetter(_p, "percent", _p.getPercent, _p.setPercent);
617 
618 _p = null;
619 
620 /**
621  * allocates and initializes a UISlider.
622  * @constructs
623  * @return {ccui.Slider}
624  * @example
625  * // example
626  * var uiSlider = ccui.Slider.create();
627  */
628 ccui.Slider.create = function () {
629     return new ccui.Slider();
630 };
631 
632 // Constant
633 //Slider event type
634 ccui.Slider.EVENT_PERCENT_CHANGED = 0;
635 
636 //Render zorder
637 ccui.Slider.BASEBAR_RENDERER_ZORDER = -3;
638 ccui.Slider.PROGRESSBAR_RENDERER_ZORDER = -2;
639 ccui.Slider.BALL_RENDERER_ZORDER = -1;