1 /**************************************************************************** 2 Copyright (c) 2011-2012 cocos2d-x.org 3 Copyright (c) 2013-2014 Chukong Technologies Inc. 4 Copyright (c) 2012 James Chen 5 6 http://www.cocos2d-x.org 7 8 Permission is hereby granted, free of charge, to any person obtaining a copy 9 of this software and associated documentation files (the "Software"), to deal 10 in the Software without restriction, including without limitation the rights 11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 copies of the Software, and to permit persons to whom the Software is 13 furnished to do so, subject to the following conditions: 14 15 The above copyright notice and this permission notice shall be included in 16 all copies or substantial portions of the Software. 17 18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 THE SOFTWARE. 25 ****************************************************************************/ 26 27 /** 28 * @constant 29 * @type Number 30 */ 31 cc.KEYBOARD_RETURNTYPE_DEFAULT = 0; 32 33 /** 34 * @constant 35 * @type Number 36 */ 37 cc.KEYBOARD_RETURNTYPE_DONE = 1; 38 39 /** 40 * @constant 41 * @type Number 42 */ 43 cc.KEYBOARD_RETURNTYPE_SEND = 2; 44 45 /** 46 * @constant 47 * @type Number 48 */ 49 cc.KEYBOARD_RETURNTYPE_SEARCH = 3; 50 51 /** 52 * @constant 53 * @type Number 54 */ 55 cc.KEYBOARD_RETURNTYPE_GO = 4; 56 57 /** 58 * The EditBoxInputMode defines the type of text that the user is allowed * to enter. 59 * @constant 60 * @type Number 61 */ 62 cc.EDITBOX_INPUT_MODE_ANY = 0; 63 64 /** 65 * The user is allowed to enter an e-mail address. 66 * @constant 67 * @type Number 68 */ 69 cc.EDITBOX_INPUT_MODE_EMAILADDR = 1; 70 71 /** 72 * The user is allowed to enter an integer value. 73 * @constant 74 * @type Number 75 */ 76 cc.EDITBOX_INPUT_MODE_NUMERIC = 2; 77 78 /** 79 * The user is allowed to enter a phone number. 80 * @constant 81 * @type Number 82 */ 83 cc.EDITBOX_INPUT_MODE_PHONENUMBER = 3; 84 85 /** 86 * The user is allowed to enter a URL. 87 * @constant 88 * @type Number 89 */ 90 cc.EDITBOX_INPUT_MODE_URL = 4; 91 92 /** 93 * The user is allowed to enter a real number value. 94 * This extends kEditBoxInputModeNumeric by allowing a decimal point. 95 * @constant 96 * @type Number 97 */ 98 cc.EDITBOX_INPUT_MODE_DECIMAL = 5; 99 100 /** 101 * The user is allowed to enter any text, except for line breaks. 102 * @constant 103 * @type Number 104 */ 105 cc.EDITBOX_INPUT_MODE_SINGLELINE = 6; 106 107 /** 108 * Indicates that the text entered is confidential data that should be 109 * obscured whenever possible. This implies EDIT_BOX_INPUT_FLAG_SENSITIVE. 110 * @constant 111 * @type Number 112 */ 113 cc.EDITBOX_INPUT_FLAG_PASSWORD = 0; 114 115 /** 116 * Indicates that the text entered is sensitive data that the 117 * implementation must never store into a dictionary or table for use 118 * in predictive, auto-completing, or other accelerated input schemes. 119 * A credit card number is an example of sensitive data. 120 * @constant 121 * @type Number 122 */ 123 cc.EDITBOX_INPUT_FLAG_SENSITIVE = 1; 124 125 /** 126 * This flag is a hint to the implementation that during text editing, 127 * the initial letter of each word should be capitalized. 128 * @constant 129 * @type Number 130 */ 131 cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_WORD = 2; 132 133 /** 134 * This flag is a hint to the implementation that during text editing, 135 * the initial letter of each sentence should be capitalized. 136 * @constant 137 * @type Number 138 */ 139 cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_SENTENCE = 3; 140 141 /** 142 * Capitalize all characters automatically. 143 * @constant 144 * @type Number 145 */ 146 cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_ALL_CHARACTERS = 4; 147 148 cc.EditBoxDelegate = cc.Class.extend({ 149 /** 150 * This method is called when an edit box gains focus after keyboard is shown. 151 * @param {cc.EditBox} sender 152 */ 153 editBoxEditingDidBegin: function (sender) { 154 }, 155 156 /** 157 * This method is called when an edit box loses focus after keyboard is hidden. 158 * @param {cc.EditBox} sender 159 */ 160 editBoxEditingDidEnd: function (sender) { 161 }, 162 163 /** 164 * This method is called when the edit box text was changed. 165 * @param {cc.EditBox} sender 166 * @param {String} text 167 */ 168 editBoxTextChanged: function (sender, text) { 169 }, 170 171 /** 172 * This method is called when the return button was pressed or the outside area of keyboard was touched. 173 * @param {cc.EditBox} sender 174 */ 175 editBoxReturn: function (sender) { 176 } 177 }); 178 179 /** 180 * <p>cc.EditBox is a brief Class for edit box.<br/> 181 * You can use this widget to gather small amounts of text from the user.</p> 182 * 183 * @class 184 * @extends cc.ControlButton 185 * 186 * @property {String} string - Content string of edit box 187 * @property {String} maxLength - Max length of the content string 188 * @property {String} font - <@writeonly> Config font of edit box 189 * @property {String} fontName - <@writeonly> Config font name of edit box 190 * @property {Number} fontSize - <@writeonly> Config font size of edit box 191 * @property {cc.Color} fontColor - <@writeonly> Config font color of edit box 192 * @property {String} placeHolder - Place holder of edit box 193 * @property {String} placeHolderFont - <@writeonly> Config font of place holder 194 * @property {String} placeHolderFontName - <@writeonly> Config font name of place holder 195 * @property {Number} placeHolderFontSize - <@writeonly> Config font size of place holder 196 * @property {cc.Color} placeHolderFontColor - <@writeonly> Config font color of place holder 197 * @property {Number} inputFlag - <@writeonly> Input flag of edit box, one of the EditBoxInputFlag constants. e.g.cc.EDITBOX_INPUT_FLAG_PASSWORD 198 * @property {Object} delegate - <@writeonly> Delegate of edit box 199 * @property {Number} inputMode - <@writeonly> Input mode of the edit box. Value should be one of the EditBoxInputMode constants. 200 * @property {Number} returnType - <@writeonly> Return type of edit box, value should be one of the KeyboardReturnType constants. 201 * 202 */ 203 cc.EditBox = cc.ControlButton.extend({ 204 _domInputSprite: null, 205 206 _delegate: null, 207 _editBoxInputMode: cc.EDITBOX_INPUT_MODE_ANY, 208 _editBoxInputFlag: cc.EDITBOX_INPUT_FLAG_SENSITIVE, 209 _keyboardReturnType: cc.KEYBOARD_RETURNTYPE_DEFAULT, 210 211 _text: "", 212 _placeholderText: "", 213 _textColor: null, 214 _placeholderColor: null, 215 _maxLength: 50, 216 _adjustHeight: 18, 217 218 _edTxt: null, 219 _edFontSize: 14, 220 _edFontName: "Arial", 221 222 _placeholderFontName: "", 223 _placeholderFontSize: 14, 224 225 _tooltip: false, 226 _className: "EditBox", 227 228 /** 229 * @constructor 230 * @param size 231 * @param normal9SpriteBg 232 * @param press9SpriteBg 233 * @param disabled9SpriteBg 234 */ 235 ctor: function (size, normal9SpriteBg, press9SpriteBg, disabled9SpriteBg) { 236 cc.ControlButton.prototype.ctor.call(this); 237 238 this._textColor = cc.color.WHITE; 239 this._placeholderColor = cc.color.GRAY; 240 this.setContentSize(size); 241 var tmpDOMSprite = this._domInputSprite = new cc.Sprite(); 242 tmpDOMSprite.draw = function () { 243 }; //redefine draw function 244 this.addChild(tmpDOMSprite); 245 var selfPointer = this; 246 var tmpEdTxt = this._edTxt = cc.newElement("input"); 247 tmpEdTxt.type = "text"; 248 tmpEdTxt.style.fontSize = this._edFontSize + "px"; 249 tmpEdTxt.style.color = "#000000"; 250 tmpEdTxt.style.border = 0; 251 tmpEdTxt.style.background = "transparent"; 252 //tmpEdTxt.style.paddingLeft = "2px"; 253 tmpEdTxt.style.width = "100%"; 254 tmpEdTxt.style.height = "100%"; 255 tmpEdTxt.style.active = 0; 256 tmpEdTxt.style.outline = "medium"; 257 var onCanvasClick = function() { 258 tmpEdTxt.blur(); 259 }; 260 261 // TODO the event listener will be remove when EditBox removes from parent. 262 cc._addEventListener(tmpEdTxt, "input", function () { 263 if (selfPointer._delegate && selfPointer._delegate.editBoxTextChanged) 264 selfPointer._delegate.editBoxTextChanged(selfPointer, this.value); 265 }); 266 cc._addEventListener(tmpEdTxt, "keypress", function (e) { 267 if (e.keyCode === cc.KEY.enter) { 268 e.stopPropagation(); 269 e.preventDefault(); 270 cc._canvas.focus(); 271 } 272 }); 273 cc._addEventListener(tmpEdTxt, "focus", function () { 274 if (this.value == selfPointer._placeholderText) { 275 this.value = ""; 276 this.style.fontSize = selfPointer._edFontSize + "px"; 277 this.style.color = cc.colorToHex(selfPointer._textColor); 278 } 279 if (selfPointer._delegate && selfPointer._delegate.editBoxEditingDidBegin) 280 selfPointer._delegate.editBoxEditingDidBegin(selfPointer); 281 cc._addEventListener(cc._canvas, "click", onCanvasClick); 282 }); 283 cc._addEventListener(tmpEdTxt, "blur", function () { 284 if (this.value == "") { 285 this.value = selfPointer._placeholderText; 286 this.style.fontSize = selfPointer._placeholderFontSize + "px"; 287 this.style.color = cc.colorToHex(selfPointer._placeholderColor); 288 } 289 if (selfPointer._delegate && selfPointer._delegate.editBoxEditingDidEnd) 290 selfPointer._delegate.editBoxEditingDidEnd(selfPointer); 291 if (selfPointer._delegate && selfPointer._delegate.editBoxReturn) 292 selfPointer._delegate.editBoxReturn(selfPointer); 293 cc._canvas.removeEventListener('click', onCanvasClick); 294 }); 295 296 cc.DOM.convert(tmpDOMSprite); 297 tmpDOMSprite.dom.appendChild(tmpEdTxt); 298 tmpDOMSprite.dom.showTooltipDiv = false; 299 tmpDOMSprite.dom.style.width = (size.width - 6) + "px"; 300 tmpDOMSprite.dom.style.height = (size.height - 6) + "px"; 301 302 //this._domInputSprite.dom.style.borderWidth = "1px"; 303 //this._domInputSprite.dom.style.borderStyle = "solid"; 304 //this._domInputSprite.dom.style.borderRadius = "8px"; 305 tmpDOMSprite.canvas.remove(); 306 307 if (this.initWithSizeAndBackgroundSprite(size, normal9SpriteBg)) { 308 if (press9SpriteBg) 309 this.setBackgroundSpriteForState(press9SpriteBg, cc.CONTROL_STATE_HIGHLIGHTED); 310 311 if (disabled9SpriteBg) 312 this.setBackgroundSpriteForState(disabled9SpriteBg, cc.CONTROL_STATE_DISABLED); 313 } 314 }, 315 316 /** 317 * Set the font. 318 * @param {String} fontName The font name. 319 * @param {Number} fontSize The font size. 320 */ 321 setFont: function (fontName, fontSize) { 322 this._edFontSize = fontSize; 323 this._edFontName = fontName; 324 this._setFontToEditBox(); 325 }, 326 327 _setFont: function (fontStyle) { 328 var res = cc.LabelTTF._fontStyleRE.exec(fontStyle); 329 if (res) { 330 this._edFontSize = parseInt(res[1]); 331 this._edFontName = res[2]; 332 this._setFontToEditBox(); 333 } 334 }, 335 336 /** 337 * set fontName 338 * @param {String} fontName 339 */ 340 setFontName: function (fontName) { 341 this._edFontName = fontName; 342 this._setFontToEditBox(); 343 }, 344 345 /** 346 * set fontSize 347 * @param {Number} fontSize 348 */ 349 setFontSize: function (fontSize) { 350 this._edFontSize = fontSize; 351 this._setFontToEditBox(); 352 }, 353 354 _setFontToEditBox: function () { 355 if (this._edTxt.value != this._placeholderText) { 356 this._edTxt.style.fontFamily = this._edFontName; 357 this._edTxt.style.fontSize = this._edFontSize + "px"; 358 } 359 }, 360 361 /** 362 * Set the text entered in the edit box. 363 * @deprecated 364 * @param {string} text The given text. 365 */ 366 setText: function (text) { 367 cc.log("Please use the setString"); 368 if (text != null) { 369 if (text == "") { 370 this._edTxt.value = this._placeholderText; 371 this._edTxt.style.color = cc.colorToHex(this._placeholderColor); 372 } else { 373 this._edTxt.value = text; 374 this._edTxt.style.color = cc.colorToHex(this._textColor); 375 } 376 } 377 }, 378 379 /** 380 * Set the text entered in the edit box. 381 * @param {string} text The given text. 382 */ 383 setString: function (text) { 384 if (text != null) { 385 if (text == "") { 386 this._edTxt.value = this._placeholderText; 387 this._edTxt.style.color = cc.colorToHex(this._placeholderColor); 388 } else { 389 this._edTxt.value = text; 390 this._edTxt.style.color = cc.colorToHex(this._textColor); 391 } 392 } 393 }, 394 395 /** 396 * Set the font color of the widget's text. 397 * @param {cc.Color} color 398 */ 399 setFontColor: function (color) { 400 this._textColor = color; 401 if (this._edTxt.value != this._placeholderText) { 402 this._edTxt.style.color = cc.colorToHex(color); 403 } 404 }, 405 406 /** 407 * <p> 408 * Sets the maximum input length of the edit box. <br/> 409 * Setting this value enables multiline input mode by default. 410 * </p> 411 * @param {Number} maxLength The maximum length. 412 */ 413 setMaxLength: function (maxLength) { 414 if (!isNaN(maxLength) && maxLength > 0) { 415 this._maxLength = maxLength; 416 this._edTxt.maxLength = maxLength; 417 } 418 }, 419 420 /** 421 * Gets the maximum input length of the edit box. 422 * @return {Number} Maximum input length. 423 */ 424 getMaxLength: function () { 425 return this._maxLength; 426 }, 427 428 /** 429 * Set a text in the edit box that acts as a placeholder when an edit box is empty. 430 * @param {string} text The given text. 431 */ 432 setPlaceHolder: function (text) { 433 if (text != null) { 434 var oldPlaceholderText = this._placeholderText; 435 this._placeholderText = text; 436 if (this._edTxt.value == oldPlaceholderText) { 437 this._edTxt.value = text; 438 this._edTxt.style.color = cc.colorToHex(this._placeholderColor); 439 this._setPlaceholderFontToEditText(); 440 } 441 } 442 }, 443 444 /** 445 * Set the placeholder's font. 446 * @param {String} fontName 447 * @param {Number} fontSize 448 */ 449 setPlaceholderFont: function (fontName, fontSize) { 450 this._placeholderFontName = fontName; 451 this._placeholderFontSize = fontSize; 452 this._setPlaceholderFontToEditText(); 453 }, 454 _setPlaceholderFont: function (fontStyle) { 455 var res = cc.LabelTTF._fontStyleRE.exec(fontStyle); 456 if (res) { 457 this._placeholderFontName = res[2]; 458 this._placeholderFontSize = parseInt(res[1]); 459 this._setPlaceholderFontToEditText(); 460 } 461 }, 462 463 /** 464 * Set the placeholder's fontName. 465 * @param {String} fontName 466 */ 467 setPlaceholderFontName: function (fontName) { 468 this._placeholderFontName = fontName; 469 this._setPlaceholderFontToEditText(); 470 }, 471 472 /** 473 * Set the placeholder's fontSize. 474 * @param {Number} fontSize 475 */ 476 setPlaceholderFontSize: function (fontSize) { 477 this._placeholderFontSize = fontSize; 478 this._setPlaceholderFontToEditText(); 479 }, 480 481 _setPlaceholderFontToEditText: function () { 482 if (this._edTxt.value == this._placeholderText) { 483 this._edTxt.style.fontFamily = this._placeholderFontName; 484 this._edTxt.style.fontSize = this._placeholderFontSize + "px"; 485 } 486 }, 487 488 /** 489 * Set the font color of the placeholder text when the edit box is empty. 490 * @param {cc.Color} color 491 */ 492 setPlaceholderFontColor: function (color) { 493 this._placeholderColor = color; 494 if (this._edTxt.value == this._placeholderText) { 495 this._edTxt.style.color = cc.colorToHex(color); 496 } 497 }, 498 499 /** 500 * Set the input flags that are to be applied to the edit box. 501 * @param {Number} inputFlag One of the EditBoxInputFlag constants. 502 * e.g.cc.EDITBOX_INPUT_FLAG_PASSWORD 503 */ 504 setInputFlag: function (inputFlag) { 505 this._editBoxInputFlag = inputFlag; 506 if (inputFlag == cc.EDITBOX_INPUT_FLAG_PASSWORD) 507 this._edTxt.type = "password"; 508 else 509 this._edTxt.type = "text"; 510 }, 511 512 /** 513 * Gets the input string of the edit box. 514 * @deprecated 515 * @return {string} 516 */ 517 getText: function () { 518 cc.log("Please use the getString"); 519 return this._edTxt.value; 520 }, 521 522 /** 523 * Gets the input string of the edit box. 524 * @return {string} 525 */ 526 getString: function () { 527 return this._edTxt.value; 528 }, 529 530 /** 531 * Init edit box with specified size. 532 * @param {cc.Size} size 533 * @param {cc.Color | cc.Scale9Sprite} normal9SpriteBg 534 */ 535 initWithSizeAndBackgroundSprite: function (size, normal9SpriteBg) { 536 if (this.initWithBackgroundSprite(normal9SpriteBg)) { 537 this._domInputSprite.x = 3; 538 this._domInputSprite.y = 3; 539 540 this.setZoomOnTouchDown(false); 541 this.setPreferredSize(size); 542 this.x = 0; 543 this.y = 0; 544 this._addTargetWithActionForControlEvent(this, this.touchDownAction, cc.CONTROL_EVENT_TOUCH_UP_INSIDE); 545 return true; 546 } 547 return false; 548 }, 549 550 /* override functions */ 551 /** 552 * Set the delegate for edit box. 553 */ 554 setDelegate: function (delegate) { 555 this._delegate = delegate; 556 }, 557 558 /** 559 * Get a text in the edit box that acts as a placeholder when an 560 * edit box is empty. 561 * @return {String} 562 */ 563 getPlaceHolder: function () { 564 return this._placeholderText; 565 }, 566 567 /** 568 * Set the input mode of the edit box. 569 * @param {Number} inputMode One of the EditBoxInputMode constants. 570 */ 571 setInputMode: function (inputMode) { 572 this._editBoxInputMode = inputMode; 573 }, 574 575 /** 576 * Set the return type that are to be applied to the edit box. 577 * @param {Number} returnType One of the CCKeyboardReturnType constants. 578 */ 579 setReturnType: function (returnType) { 580 this._keyboardReturnType = returnType; 581 }, 582 583 keyboardWillShow: function (info) { 584 var rectTracked = cc.EditBox.getRect(this); 585 // some adjustment for margin between the keyboard and the edit box. 586 rectTracked.y -= 4; 587 // if the keyboard area doesn't intersect with the tracking node area, nothing needs to be done. 588 if (!rectTracked.intersectsRect(info.end)) { 589 cc.log("needn't to adjust view layout."); 590 return; 591 } 592 593 // assume keyboard at the bottom of screen, calculate the vertical adjustment. 594 this._adjustHeight = info.end.getMaxY() - rectTracked.getMinY(); 595 // CCLOG("CCEditBox:needAdjustVerticalPosition(%f)", m_fAdjustHeight); 596 597 //callback 598 }, 599 keyboardDidShow: function (info) { 600 }, 601 keyboardWillHide: function (info) { 602 //if (m_pEditBoxImpl != NULL) { 603 // m_pEditBoxImpl->doAnimationWhenKeyboardMove(info.duration, -m_fAdjustHeight); 604 //} 605 }, 606 keyboardDidHide: function (info) { 607 }, 608 609 touchDownAction: function (sender, controlEvent) { 610 //this._editBoxImpl.openKeyboard(); 611 }, 612 613 //HTML5 Only 614 initWithBackgroundColor: function (size, bgColor) { 615 this._edWidth = size.width; 616 this.dom.style.width = this._edWidth.toString() + "px"; 617 this._edHeight = size.height; 618 this.dom.style.height = this._edHeight.toString() + "px"; 619 this.dom.style.backgroundColor = cc.colorToHex(bgColor); 620 } 621 }); 622 623 var _p = cc.EditBox.prototype; 624 625 // Extended properties 626 /** @expose */ 627 _p.font; 628 cc.defineGetterSetter(_p, "font", null, _p._setFont); 629 /** @expose */ 630 _p.fontName; 631 cc.defineGetterSetter(_p, "fontName", null, _p.setFontName); 632 /** @expose */ 633 _p.fontSize; 634 cc.defineGetterSetter(_p, "fontSize", null, _p.setFontSize); 635 /** @expose */ 636 _p.fontColor; 637 cc.defineGetterSetter(_p, "fontColor", null, _p.setFontColor); 638 /** @expose */ 639 _p.string; 640 cc.defineGetterSetter(_p, "string", _p.getString, _p.setString); 641 /** @expose */ 642 _p.maxLength; 643 cc.defineGetterSetter(_p, "maxLength", _p.getMaxLength, _p.setMaxLength); 644 /** @expose */ 645 _p.placeHolder; 646 cc.defineGetterSetter(_p, "placeHolder", _p.getPlaceHolder, _p.setPlaceHolder); 647 /** @expose */ 648 _p.placeHolderFont; 649 cc.defineGetterSetter(_p, "placeHolderFont", null, _p._setPlaceholderFont); 650 /** @expose */ 651 _p.placeHolderFontName; 652 cc.defineGetterSetter(_p, "placeHolderFontName", null, _p.setPlaceholderFontName); 653 /** @expose */ 654 _p.placeHolderFontSize; 655 cc.defineGetterSetter(_p, "placeHolderFontSize", null, _p.setPlaceholderFontSize); 656 /** @expose */ 657 _p.placeHolderFontColor; 658 cc.defineGetterSetter(_p, "placeHolderFontColor", null, _p.setPlaceholderFontColor); 659 /** @expose */ 660 _p.inputFlag; 661 cc.defineGetterSetter(_p, "inputFlag", null, _p.setInputFlag); 662 /** @expose */ 663 _p.delegate; 664 cc.defineGetterSetter(_p, "delegate", null, _p.setDelegate); 665 /** @expose */ 666 _p.inputMode; 667 cc.defineGetterSetter(_p, "inputMode", null, _p.setInputMode); 668 /** @expose */ 669 _p.returnType; 670 cc.defineGetterSetter(_p, "returnType", null, _p.setReturnType); 671 672 _p = null; 673 674 cc.EditBox.getRect = function (node) { 675 var contentSize = node.getContentSize(); 676 var rect = cc.rect(0, 0, contentSize.width, contentSize.height); 677 return cc.rectApplyAffineTransform(rect, node.nodeToWorldTransform()); 678 }; 679 680 /** 681 * create a edit box with size and background-color or 682 * @deprecated 683 * @param {cc.Size} size 684 * @param {cc.Scale9Sprite } normal9SpriteBg 685 * @param {cc.Scale9Sprite } [press9SpriteBg] 686 * @param {cc.Scale9Sprite } [disabled9SpriteBg] 687 */ 688 cc.EditBox.create = function (size, normal9SpriteBg, press9SpriteBg, disabled9SpriteBg) { 689 return new cc.EditBox(size, normal9SpriteBg, press9SpriteBg, disabled9SpriteBg); 690 }; 691 692 693 694 695