Cocos Creator API

1.4.x

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

ScrollView

Extends Component
Module: cc

Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display.

Properties

content Node

This is a reference to the UI element to be scrolled.

horizontal Boolean

Enable horizontal scroll.

vertical Boolean

Enable vertical scroll.

inertia Boolean

When inertia is set, the content will continue to move when touch ended.

brake Number

It determines how quickly the content stop moving. A value of 1 will stop the movement immediately. A value of 0 will never stop the movement until it reaches to the boundary of scrollview.

elastic Boolean

When elastic is set, the content will be bounce back when move out of boundary.

bounceDuration Number

The elapse time of bouncing back. A value of 0 will bounce back immediately.

horizontalScrollBar Scrollbar

The horizontal scrollbar reference.

verticalScrollBar Scrollbar

The vertical scrollbar reference.

scrollEvents Component.EventHandler[]

Scrollview events callback

cancelInnerEvents Boolean

If cancelInnerEvents is set to true, the scroll behavior will cancel touch events on inner content nodes It's set to true by default.

__eventTargets Array private

Inherited from Component:

Register all related EventTargets, all event callbacks will be removed in _onPreDestroy

node Node

Inherited from Component:

The node this component is attached to. A component is always attached to a node.

examples:

cc.log(comp.node);

uuid String readOnly

Inherited from Component:

The uuid for editor.

examples:

cc.log(comp.uuid);

_enabled Boolean private

Inherited from Component:

enabled Boolean

Inherited from Component:

indicates whether this component is enabled or not.

examples:

comp.enabled = true;
cc.log(comp.enabled);

enabledInHierarchy Boolean readOnly

Inherited from Component:

indicates whether this component is enabled and its node is also active in the hierarchy.

examples:

cc.log(comp.enabledInHierarchy);

_isOnLoadCalled Boolean readOnly

Inherited from Component:

TODO

examples:

cc.log(_isOnLoadCalled);

_name String private

_objFlags Number private

name String

The name of the object.

examples:

obj.name = "New Obj";

isValid Boolean readOnly

Indicates whether the object is not yet destroyed.

examples:

cc.log(obj.isValid);

There are no properties that match your current filter settings. You can change your filter settings in the index section on this page. index

Methods

scrollToBottom
(
  • [timeInSecond =0]
  • [attenuated =true]
)

Scroll the content to the bottom boundary of ScrollView.

name type description
timeInSecond optional Number 0

Scroll time in second, if you don't pass timeInSecond, the content will jump to the bottom boundary immediately.

attenuated optional Boolean true

Whether the scroll acceleration attenuated, default is true.