Cocos Creator API

1.4.x

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

EditBox

Module: cc

cc.EditBox is a component for inputing text, you can use it to gather small amounts of text from users.

Properties

string String

Input string of EditBox.

backgroundImage SpriteFrame

The background image of EditBox.

returnType EditBox.KeyboardReturnType

The return key type of EditBox. Note: it is meaningless for web platforms and desktop platforms.

inputFlag EditBox.InputFlag

Set the input flags that are to be applied to the EditBox.

inputMode EditBox.InputMode

Set the input mode of the edit box. If you pass ANY, it will create a multiline EditBox.

fontSize Number

Font size of the input text.

lineHeight Number

Change the lineHeight of displayed text.

fontColor Color

Font color of the input text.

placeholder String

The display text of placeholder.

placeholderFontSize Number

The font size of placeholder.

placeholderFontColor Color

The font color of placeholder.

maxLength Number

The maximize input length of EditBox.

  • If pass a value less than 0, it won't limit the input number of characters.
  • If pass 0, it doesn't allow input any characters.

stayOnTop Boolean

The input is always visible and be on top of the game view. !zh 输入框总是可见,并且永远在游戏视图的上面 Note: only available on Web at the moment.

tabIndex Number

Set the tabIndex of the DOM input element, only useful on Web.

editingDidBegin Component.EventHandler

The event handler to be called when EditBox began to edit text.

textChanged Component.EventHandler

The event handler to be called when EditBox text changes.

editingDidEnded Component.EventHandler

The event handler to be called when EditBox edit ends.

editingReturn Component.EventHandler

The event handler to be called when return key is pressed. Windows is not supported.

_sgNode _ccsg.Node private

Reference to the instance of _ccsg.Node If it is possible to return null from your overloaded _createSgNode, then you should always check for null before using this property and reimplement __preload.

__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.