Class ccui.Slider

Class Summary
Constructor Attributes Constructor Name and Description
 
The Slider control of Cocos UI.

Method Summary

Class Detail

ccui.Slider()
The Slider control of Cocos UI.

Field Detail

<static> <constant> ccui.Slider.BALL_RENDERER_ZORDER
The zOrder value of ccui.Slider's ball renderer.
<static> <constant> ccui.Slider.BASEBAR_RENDERER_ZORDER
The zOrder value of ccui.Slider's base bar renderer.
<static> <constant> ccui.Slider.EVENT_PERCENT_CHANGED
The percent change event flag of ccui.Slider.
{Number} percent
- The current progress of loadingbar
<static> <constant> ccui.Slider.PROGRESSBAR_RENDERER_ZORDER
The zOrder value of ccui.Slider's progress bar renderer.

Method Detail

  • addEventListener(selector, target)
    Adds a callback
    Parameters:
    {Function} selector
    {Object} target Optional
  • addEventListenerSlider(selector, target)
    add event listener
    Parameters:
    {Function} selector
    {Object} target Optional
    Deprecated:
    since v3.0, please use addEventListener instead.
  • <static> {ccui.Slider} ccui.Slider.create(barTextureName, normalBallTextureName, resType)
    allocates and initializes a UISlider.
    Parameters:
    barTextureName
    normalBallTextureName
    resType
    Deprecated:
    since v3.0, please use new ccui.Slider() instead.
    Returns:
    {ccui.Slider}
  • ctor(barTextureName, normalBallTextureName, resType)
    allocates and initializes a UISlider. Constructor of ccui.Slider. override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
    // example
    var uiSlider = new ccui.Slider();
    Parameters:
    barTextureName
    normalBallTextureName
    resType
  • {cc.Rect} getCapInsetsBarRenderer()
    Returns cap insets for slider.
    Returns:
    {cc.Rect}
  • {cc.Rect} getCapInsetsProgressBarRenderer()
    Returns cap insets of ProgressBar for slider.
    Returns:
    {cc.Rect}
  • {string} getDescription()
    Returns the "class name" of ccui.LoadingBar.
    Returns:
    {string}
  • {number} getPercent()
    Gets the progress direction of slider.
    Returns:
    {number}
  • {cc.Node} getVirtualRenderer()
    Returns the bar renderer.
    Returns:
    {cc.Node}
  • {cc.Size} getVirtualRendererSize()
    Returns the content size of bar renderer.
    Returns:
    {cc.Size}
  • {boolean} hitTest(pt)
    test the point whether location in loadingBar's bounding box.
    Parameters:
    {cc.Point} pt
    Returns:
    {boolean}
  • ignoreContentAdaptWithSize(ignore)
    override "ignoreContentAdaptWithSize" method of widget.
    Parameters:
    {Boolean} ignore
  • {boolean} init()
    Initializes a ccui.Slider. Please do not call this function by yourself, you should pass the parameters to constructor to initialize it.
    Returns:
    {boolean}
  • {Boolean} isScale9Enabled()
    Returns slider is using scale9 renderer or not.
    Returns:
    {Boolean}
  • loadBarTexture(fileName, texType)
    Loads texture for slider bar.
    Parameters:
    {String} fileName
    {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
  • loadProgressBarTexture(fileName, texType)
    Loads dark state texture for slider progress bar.
    Parameters:
    {String} fileName
    {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
  • loadSlidBallTextureDisabled(disabled, texType)
    Load dark state texture for slider ball.
    Parameters:
    {String} disabled
    {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
  • loadSlidBallTextureNormal(normal, texType)
    Loads normal state texture for slider ball.
    Parameters:
    {String} normal
    {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
  • loadSlidBallTexturePressed(pressed, texType)
    Loads selected state texture for slider ball.
    Parameters:
    {String} pressed
    {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
  • loadSlidBallTextures(normal, pressed, disabled, texType)
    Loads textures for slider ball.
    Parameters:
    {String} normal
    {String} pressed
    {String} disabled
    {ccui.Widget.LOCAL_TEXTURE|ccui.Widget.PLIST_TEXTURE} texType
  • setCapInsetProgressBarRenderer(capInsets)
    Sets capinsets of ProgressBar for slider, if slider is using scale9 renderer.
    Parameters:
    {cc.Rect} capInsets
  • setCapInsets(capInsets)
    Sets capinsets for slider, if slider is using scale9 renderer.
    Parameters:
    {cc.Rect} capInsets
  • setCapInsetsBarRenderer(capInsets)
    Sets capinsets for slider's renderer, if slider is using scale9 renderer.
    Parameters:
    {cc.Rect} capInsets
  • setPercent(percent)
    Changes the progress direction of slider.
    Parameters:
    {number} percent
  • setScale9Enabled(able)
    Sets if slider is using scale9 renderer.
    Parameters:
    {Boolean} able