/** @language english
* Creates a new LTextField instance. After you create the LTextField instance, call the addChild() or addChildAt() method of the parent LSprite object to add the LTextField instance to the display list.
* The methods of the LTextField class let you set, select, and manipulate text in a dynamic or input text field that you create during authoring or at runtime.
* @class LTextField
* @extends LInteractiveObject
* @constructor
* @example
* var theTextField = new LTextField();
* theTextField.setType(LTextFieldType.INPUT);
* theTextField.x = 10;
* theTextField.y = 10;
* addChild(theTextField);
* @examplelink <p><a href="../../../api/LTextField/index.html" target="_blank">Try it »</a></p>
* @since 1.0.0
* @public
*/
var LTextField = (function () {
function LTextField () {
var s = this;
LExtends(s, LInteractiveObject, []);
/** @language english
* type of the object
* @property type
* @type String
* @default LTextField
* @since 1.0.0
* @public
*/
s.type = "LTextField";
s.texttype = null;
/** @language english
* A string that is the current text in the text field. Lines are separated by the carriage return character ('\n').
* @property text
* @type String
* @since 1.0.0
* @public
*/
s.text = "";
/** @language english
* The name of the font for text in this text format, as a string. The default value is null, which means that Flash Player uses Times New Roman font for the text.
* @property font
* @type String
* @since 1.0.0
* @default Arial
* @example
* var theTextField = new LTextField();
* theTextField.text = "font test";
* theTextField.x = 10;
* theTextField.y = 10;
* theTextField.font = "Georgia";
* addChild(theTextField);
* @examplelink <p><a href="../../../api/LTextField/font.html" target="_blank">Try it »</a></p>
* @public
*/
s.font = "Arial";
/** @language english
* The size in pixels of text in this text format.
* @property size
* @type int
* @since 1.0.0
* @default 11
* @example
* var theTextField = new LTextField();
* theTextField.text = "size test";
* theTextField.x = 10;
* theTextField.y = 10;
* theTextField.size = 20;
* addChild(theTextField);
* @examplelink <p><a href="../../../api/LTextField/size.html" target="_blank">Try it »</a></p>
* @public
*/
s.size = "11";
/** @language english
* Indicates the color of the text.
* @property color
* @type String
* @since 1.0.0
* @default "#000000"
* @example
* var theTextField = new LTextField();
* theTextField.text = "color test";
* theTextField.x = 10;
* theTextField.y = 10;
* theTextField.color = "#FF0000";
* addChild(theTextField);
* @examplelink <p><a href="../../../api/LTextField/color.html" target="_blank">Try it »</a></p>
* @public
*/
s.color = "#000000";
/** @language english
* Specifies whether the text is boldface.
* @property weight
* @type String
* @since 1.0.0
* @default normal
* @example
* var theTextField = new LTextField();
* theTextField.text = "weight test";
* theTextField.x = 10;
* theTextField.y = 10;
* theTextField.weight = "bolder";
* addChild(theTextField);
* @examplelink <p><a href="../../../api/LTextField/weight.html" target="_blank">Try it »</a></p>
* @public
*/
s.weight = "normal";
/** @language english
* Indicates the alignment of the paragraph(horizontal).
* @property textAlign
* @type String
* @since 1.0.0
* @default left
* @public
*/
s.textAlign = "left";
/** @language english
* Indicates the alignment of the paragraph(vertical).
* @property textBaseline
* @type String
* @since 1.0.0
* @default top
* @public
*/
s.textBaseline = "top";
s.heightMode = LTextField.HEIGHT_MODE_BOTTOM;
/** @language english
* Text effects of stroke.
* @property stroke
* @type String
* @since 1.0.0
* @default false
* @example
* var theTextField = new LTextField();
* theTextField.text = "stroke test";
* theTextField.size = 50;
* theTextField.stroke = true;
* theTextField.lineWidth = 2;
* theTextField.lineColor = "#FF0000";
* addChild(theTextField);
* @examplelink <p><a href="../../../api/LTextField/stroke.html" target="_blank">Try it »</a></p>
* @public
*/
s.stroke = false;
/** @language english
* The line's size of stroke.
* @property lineWidth
* @type int
* @since 1.0.0
* @default 1
* @public
*/
s.lineWidth = 1;
/** @language english
* The line's color of stroke.
* @property lineColor
* @type String
* @since 1.0.0
* @default "#000000"
* @public
*/
s.lineColor = "#000000";
/** @language english
* When the text field has word wrap , you can set the width of the display object, in pixels.
* @property width
* @type int
* @since 1.0.0
* @default 150
* @public
*/
s.width = 150;
s.height = s.size;
/** @language english
* Specifies whether the text field is a password text field. If the value of this property is true, the text field is treated as a password text field and hides the input characters using asterisks instead of the actual characters. If false, the text field is not treated as a password text field.
* @property displayAsPassword
* @type Boolean
* @since 1.0.0
* @default false
* @example
* var theTextField = new LTextField();
* theTextField.setType(LTextFieldType.INPUT);
* theTextField.x = 10;
* theTextField.y = 10;
* theTextField.displayAsPassword = true;
* addChild(theTextField);
* @examplelink <p><a href="../../../api/LTextField/displayAsPassword.html" target="_blank">Try it »</a></p>
* @public
*/
s.displayAsPassword = false;
s.wordWrap = false;
s.multiline = false;
/** @language english
* Defines the number of text lines in a multiline text field. If setWordWrap(true), the number of lines increases when text wraps.
* @property numLines
* @type int
* @since 1.9.0
* @public
*/
s.numLines = 1;
/** @language english
* The Text animation's speed.
* @property speed
* @type int
* @default 0
* @since 1.0.0
* @example
* LInit(50, "legend", 800, 480, main);
* function main () {
* var theTextField = new LTextField();
* theTextField.text = "wait click";
* theTextField.x = 10;
* theTextField.y = 10;
* theTextField.size = 20;
* addChild(theTextField);
* var button = new LButtonSample1("wind test start");
* button.textField = theTextField;
* button.x = 10;
* button.y = 100;
* addChild(button);
* button.addEventListener(LMouseEvent.MOUSE_DOWN, onclick);
* }
* function windOver(event){
* var theTextField = event.target;
* theTextField.removeEventListener(LTextEvent.WIND_COMPLETE, windOver);
* theTextField.text = "wind over";
* }
* function onclick(event){
* var theTextField = event.currentTarget.textField;
* if (theTextField.hasEventListener(LTextEvent.WIND_COMPLETE)) {
* theTextField.removeEventListener(LTextEvent.WIND_COMPLETE, windOver);
* }
* theTextField.text = "TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT";
* theTextField.speed = 3;
* theTextField.wind();
* theTextField.addEventListener(LTextEvent.WIND_COMPLETE, windOver);
* }
* @examplelink <p><a href="../../../api/LTextField/wind.html" target="_blank">Try it »</a></p>
* @public
*/
s.speed = 0;
s._speedIndex = 100;
}
LTextField.HEIGHT_MODE_BOTTOM = "bottom";
LTextField.HEIGHT_MODE_BASELINE = "baseline";
var p = {
_showReady : function (c) {
var s = this;
c.font = s.weight + " " + s.size + "pt " + s.font;
c.textAlign = s.textAlign;
c.textBaseline = s.textBaseline;
},
_ll_show : function (c) {
var s = this, d, lbl, i, rc, j, l, k, m, b, enter;
if (s.texttype == LTextFieldType.INPUT) {
s.inputBackLayer.ll_show();
rc = s.getRootCoordinate();
if (LGlobal.inputBox.name == "input" + s.objectIndex) {
LGlobal.inputBox.style.marginTop = (parseInt(LGlobal.canvasObj.style.marginTop) + (((rc.y + s.inputBackLayer.startY()) * parseInt(LGlobal.canvasObj.style.height) / LGlobal.canvasObj.height) >>> 0)) + "px";
LGlobal.inputBox.style.marginLeft = (parseInt(LGlobal.canvasObj.style.marginLeft) + (((rc.x + s.inputBackLayer.startX()) * parseInt(LGlobal.canvasObj.style.width) / LGlobal.canvasObj.width) >>> 0)) + "px";
}
if (LGlobal.inputTextField && LGlobal.inputTextField.objectIndex == s.objectIndex) {
return;
}
}
lbl = s.text;
if (s.displayAsPassword) {
lbl = '';
for (i=0, l = s.text.length; i < l; i++) {
lbl += '*';
}
}
c.fillStyle = s.color;
if (s.stroke) {
c.strokeStyle = s.lineColor;
c.lineWidth = s.lineWidth + 1;
}
if (s.wordWrap || s.multiline) {
j = 0, k = 0, m = 0, b = 0;
for (i = 0, l = s.text.length; i < l; i++) {
enter = /(?:\r\n|\r|\n|¥n)/.exec(lbl.substr(i, 1));
if (enter) {
j = 0;
k = i + 1;
m++;
}
if (!enter) {
if (s.stroke) {
c.strokeText(lbl.substr(i, 1), j, m * s.wordHeight);
}
c.fillText(lbl.substr(i, 1), j, m * s.wordHeight);
}
s.numLines = m;
j = c.measureText(s.text.substr(k, i + 1 - k)).width;
if (s.wordWrap && j + c.measureText(lbl.substr(i, 1)).width > s.width) {
j = 0;
k = i + 1;
m++;
}
}
s.height = (m + 1) * s.wordHeight;
} else {
s.numLines = 1;
if (s.stroke) {
c.strokeText(lbl, 0, 0, c.measureText(lbl).width);
}
c.fillText(lbl, 0, 0, c.measureText(lbl).width);
}
if (s.windRunning) {
s._ll_windRun();
}
},
_wordHeight : function (h) {
var s = this;
if (h > 0) {
s.wordHeight = h;
} else {
s.wordWrap = false;
s.wordHeight = s.getHeight();
}
s.height = 0;
},
/** @language english
* Indicates whether field is a multiline text field. If the value is true, the text field is multiline; if the value is false, the text field is a single-line text field. In a field of type LTextFieldType.INPUT, determines whether the Enter key creates a new line (a value of false, and the Enter key is ignored).
* @method setMultiline
* @param {Boolean} value Indicates whether field is a multiline text field. If the value is true, the text field is multiline.
* @param {int} height The height of a single-line text field.
* @since 1.0.0
* @public
* @example
* var inputLayer = new LSprite();
* inputLayer.graphics.drawRect(1,"#000000",[0, 0, 400, 150]);
* var theTextField = new LTextField();
* theTextField.setType(LTextFieldType.INPUT,inputLayer);
* theTextField.setMultiline(true);
* addChild(theTextField);
* @examplelink <p><a href="../../../api/LTextField/setMultiline.html" target="_blank">Try it »</a></p>
*/
setMultiline : function (v, h) {
var s = this;
if (v) {
s._wordHeight(h);
}
s.multiline = v;
},
/** @language english
* Indicates whether the text field has word wrap. If the value of wordWrap is true, the text field has word wrap; if the value is false, the text field does not have word wrap. The default value is false.
* @method setWordWrap
* @param {Boolean} value Indicates whether the text field has word wrap.
* @param {int} height The height of a single-line text field.
* @since 1.0.0
* @public
* @example
* var theTextField = new LTextField();
* theTextField.setWordWrap(true);
* theTextField.width = 200;
* theTextField.text = "text\ntext\ntexttexttexttexttexttexttexttexttexttexttexttexttexttext";
* addChild(theTextField);
* @examplelink <p><a href="../../../api/LTextField/setWordWrap.html" target="_blank">Try it »</a></p>
*/
setWordWrap : function (v, h) {
var s = this;
if (v) {
s._wordHeight(h);
}
s.wordWrap = v;
},
/** @language english
* The type of the text field. Either one of the following LTextFieldType constants: LTextFieldType.DYNAMIC, which specifies a dynamic text field, which a user cannot edit, or LTextFieldType.INPUT, which specifies an input text field, which a user can edit.The default value is dynamic.
* @method setType
* @param {String} type The type of the text field.
* @param {LSprite} obj The object's shape.
* @since 1.0.0
* @public
* @example
* var inputLayer = new LSprite();
* inputLayer.graphics.drawRect(1,"#000000",[0, 0, 400, 30]);
* var theTextField = new LTextField();
* theTextField.setType(LTextFieldType.INPUT,inputLayer);
* addChild(theTextField);
* @examplelink <p><a href="../../../api/LTextField/setType.html" target="_blank">Try it »</a></p>
*/
setType : function (type, inputBackLayer) {
var s = this;
if (s.texttype != type && type == LTextFieldType.INPUT) {
if (inputBackLayer == null || inputBackLayer.type != "LSprite") {
s.inputBackLayer = new LSprite();
s.inputBackLayer.graphics.drawRect(1, "#000000", [0, -s.getHeight() * 0.4, s.width, s.getHeight() * 1.5]);
} else {
s.inputBackLayer = inputBackLayer;
}
s.inputBackLayer.parent = s;
if (LMouseEventContainer.container[LMouseEvent.MOUSE_DOWN]) {
LMouseEventContainer.pushInputBox(s);
}
} else {
s.inputBackLayer = null;
LMouseEventContainer.removeInputBox(s);
}
s.texttype = type;
},
ismouseon : function (e, cood) {
var s = this;
if (!e) {
return false;
}
if (!s.visible) {
return false;
}
if (!cood) {
cood = {x : 0, y : 0, scaleX : 1, scaleY : 1};
}
if (s.mask) {
if (!s.mask.parent) {
s.mask.parent = s.parent;
}
if (!s.mask.ismouseon(e, cood)) {
return false;
}
}
if (s.inputBackLayer) {
return s.inputBackLayer.ismouseon(e, {x : s.x * cood.scaleX + cood.x, y : s.y * cood.scaleY + cood.y, scaleX : cood.scaleX * s.scaleX, scaleY : cood.scaleY * s.scaleY});
}
return s.ismouseonShapes([{type : LShape.RECT, arg : [0, 0, s._getWidth(), s._getHeight()]}], e.offsetX, e.offsetY);
},
/** @language english
* Returns a new LTextField object that is a clone of the original instance with an exact copy of the object.
* @method clone
* @return {LTextField} A new LTextField object that is identical to the original.
* @since 1.8.2
* @public
* @example
* var circle1 = new LSprite();
* circle1.graphics.drawRect(1,"#000000",[0,0,100,100],true,"#000000");
* var circle2 = circle1.clone();
* circle2.y = 120;
* addChild(circle1);
* addChild(circle2);
* @examplelink <p><a href="../../../api/LSprite/clone.html" target="_blank">Try it »</a></p>
*/
clone : function () {
var s = this, a = new s.constructor();
a.copyProperty(s);
a.texttype = null;
if (s.texttype == LTextFieldType.INPUT) {
a.setType( LTextFieldType.INPUT);
}
return a;
},
mouseEvent : function (event, type, cood) {
var s = this, on;
if (s.inputBackLayer == null) {
return;
}
on = s.ismouseon(event, cood);
if (type != LMouseEvent.MOUSE_DOWN || !on) {
return;
}
s.focus();
},
_ll_getValue : function () {
if (LGlobal.inputBox.style.display != NONE) {
LGlobal.inputTextField.text = LGlobal.inputTextBox.value;
LEvent.removeEventListener(LGlobal.inputTextBox, LKeyboardEvent.KEY_DOWN, LGlobal.inputTextField._ll_input);
LGlobal.inputBox.style.display = NONE;
LGlobal.inputTextField.dispatchEvent(LFocusEvent.FOCUS_OUT);
LGlobal.inputTextField = null;
}
},
/** @language english
* If the LTextField object's texttype is LTextFieldType.INPUT, copy the text to the inputbox.
* @method updateInput
* @since 1.9.0
* @public
* @example
* var theTextField = new LTextField();
* theTextField.x = 20;
* theTextField.y = 20;
* theTextField.text = "Click Enter Key to clear the text!";
* addChild(theTextField);
* var theTextField1 = new LTextField();
* theTextField1.text = "test";
* theTextField1.x = 20;
* theTextField1.y = 100;
* theTextField1.setType(LTextFieldType.INPUT);
* addChild(theTextField1);
* theTextField1.addEventListener(LTextEvent.TEXT_INPUT, function (e) {
* if(e.keyCode == 13){
* e.currentTarget.text = "";
* e.currentTarget.updateInput();
* e.preventDefault();
* }
* });
* setTimeout(function () {
* theTextField1.focus();
* }, 200);
* @examplelink <p><a href="../../../api/LSprite/updateInput.html" target="_blank">Try it »</a></p>
*/
updateInput : function () {
var s = this;
if (s.texttype == LTextFieldType.INPUT && LGlobal.inputTextField.objectIndex == s.objectIndex) {
LGlobal.inputTextBox.value = LGlobal.inputTextField.text;
}
},
_ll_input : function (e) {
var event = new LEvent(LTextEvent.TEXT_INPUT);
event.keyCode = e.keyCode;
LGlobal.inputTextField.text = LGlobal.inputTextBox.value;
if (LGlobal.inputTextField.hasEventListener(LTextEvent.TEXT_INPUT)) {
e.returnValue = LGlobal.inputTextField.dispatchEvent(event);
} else {
e.returnValue = true;
}
},
/** @language english
* Get focus.
* @method focus
* @since 1.9.0
* @public
* @example
* var theTextField = new LTextField();
* theTextField.x = 20;
* theTextField.y = 20;
* theTextField.text = "Click the Enter Key, please!";
* addChild(theTextField);
* var theTextField1 = new LTextField();
* theTextField1.x = 20;
* theTextField1.y = 100;
* theTextField1.setType(LTextFieldType.INPUT);
* addChild(theTextField1);
* theTextField1.addEventListener(LTextEvent.TEXT_INPUT, function (e) {
* if(e.keyCode == 13){
* theTextField2.focus();
* }
* });
* var theTextField2 = new LTextField();
* theTextField2.x = 20;
* theTextField2.y = 140;
* theTextField2.setType(LTextFieldType.INPUT);
* addChild(theTextField2);
* theTextField2.addEventListener(LTextEvent.TEXT_INPUT, function (e) {
* if(e.keyCode == 13){
* theTextField1.focus();
* }
* });
* setTimeout(function () {
* theTextField1.focus();
* }, 200);
* @examplelink <p><a href="../../../api/LSprite/focus.html" target="_blank">Try it »</a></p>
*/
focus : function () {
var s = this, sc, sx;
if (!s.parent) {
return;
}
if (s.texttype != LTextFieldType.INPUT) {
return;
}
if (LGlobal.inputTextField && LGlobal.inputTextField.objectIndex != s.objectIndex) {
s._ll_getValue();
}
s.dispatchEvent(LFocusEvent.FOCUS_IN);
sc = s.getAbsoluteScale();
LGlobal.inputBox.style.display = "";
LGlobal.inputBox.name = "input" + s.objectIndex;
LGlobal.inputTextField = s;
LGlobal.inputTextareaBoxObj.style.display = NONE;
LGlobal.inputTextBoxObj.style.display = NONE;
LGlobal.passwordBoxObj.style.display = NONE;
if (s.displayAsPassword) {
LGlobal.inputTextBox = LGlobal.passwordBoxObj;
} else if (s.multiline) {
LGlobal.inputTextBox = LGlobal.inputTextareaBoxObj;
} else {
LGlobal.inputTextBox = LGlobal.inputTextBoxObj;
}
sx = parseInt(LGlobal.canvasObj.style.width) / LGlobal.canvasObj.width;
sy = parseInt(LGlobal.canvasObj.style.height) / LGlobal.canvasObj.height;
LGlobal.inputTextBox.style.display = "";
LGlobal.inputTextBox.value = s.text;
LGlobal.inputTextBox.style.height = s.inputBackLayer.getHeight() * sc.scaleY * s.scaleY * sy + "px";
LGlobal.inputTextBox.style.width = s.inputBackLayer.getWidth() * sc.scaleX * s.scaleX * sx + "px";
LGlobal.inputTextBox.style.color = s.color;
LGlobal.inputTextBox.style.fontSize = ((s.size * parseFloat(LGlobal.canvasObj.style.height) / LGlobal.canvasObj.height) >> 0) + "px";
LGlobal.inputTextBox.style.fontFamily = s.font;
LEvent.addEventListener(LGlobal.inputTextBox, LKeyboardEvent.KEY_DOWN, LGlobal.inputTextField._ll_input);
if (s.texttype == LTextFieldType.INPUT) {
rc = s.getRootCoordinate();
if (LGlobal.inputBox.name == "input" + s.objectIndex) {
LGlobal.inputBox.style.marginTop = (parseInt(LGlobal.canvasObj.style.marginTop) + (((rc.y + s.inputBackLayer.startY()) * parseInt(LGlobal.canvasObj.style.height) / LGlobal.canvasObj.height) >>> 0)) + "px";
LGlobal.inputBox.style.marginLeft = (parseInt(LGlobal.canvasObj.style.marginLeft) + (((rc.x + s.inputBackLayer.startX()) * parseInt(LGlobal.canvasObj.style.width) / LGlobal.canvasObj.width) >>> 0)) + "px";
}
}
setTimeout(function () {
LGlobal.inputTextBox.focus();
}, 0);
},
_getWidth : function () {
var s = this;
if (s.wordWrap) {
return s.width;
}
LGlobal.canvas.font = s.size + "pt " + s.font;
return LGlobal.canvas.measureText(s.text).width;
},
/** @language english
* Get the width of the display object, in pixels.
* @method getWidth
* @return {float} the width of the display object.
* @since 1.0.0
* @public
* @example
* var theTextField = new LTextField();
* theTextField.text = "getWidth test";
* addChild(theTextField);
* trace(theTextField.getWidth());
* @examplelink <p><a href="../../../api/LTextField/getWidth.html" target="_blank">Try it »</a></p>
*/
getWidth : function (maskSize) {
var s = this, w, mx, mw;
w = s._getWidth() * s.scaleX;
if (maskSize && s.mask) {
mx = s.mask._startX ? s.mask._startX() : s.mask.startX();
if (mx > w) {
return 0;
}
mw = s.mask.getWidth();
if (mx + mw > w) {
return w - mx;
} else {
return mw;
}
}
return w;
},
_getHeight : function () {
var s = this, c = LGlobal.canvas, i, l, j, k, m, enter;
if (s.wordWrap) {
c.font = s.weight + " " + s.size + "pt " + s.font;
if (s.height == 0) {
j = 0, k = 0, m = 0;
for (i = 0, l = s.text.length; i < l; i++) {
j = c.measureText(s.text.substr(k, i - k)).width;
enter = /(?:\r\n|\r|\n|¥n)/.exec(s.text.substr(i, 1));
if ((s.wordWrap && j > s.width) || enter) {
j = 0;
k = i;
m++;
if (enter) {
k++;
}
}
}
s.height = (m + 1) * s.wordHeight;
}
return s.height;
}
c.font = s.weight + " " + s.size + "pt " + s.font;
l = c.measureText("O").width * 1.2;
if (s.heightMode == LTextField.HEIGHT_MODE_BASELINE) {
l = l * 1.2;
}
return l;
},
/** @language english
* Get the height of the display object, in pixels.
* @method getHeight
* @return {float} the height of the display object.
* @since 1.0.0
* @public
* @example
* var theTextField = new LTextField();
* theTextField.text = "getHeight test";
* addChild(theTextField);
* trace(theTextField.getHeight());
* @examplelink <p><a href="../../../api/LTextField/getHeight.html" target="_blank">Try it »</a></p>
*/
getHeight : function (maskSize) {
var s = this, h, my, mh;
h = s._getHeight() * s.scaleY;
if (maskSize && s.mask) {
my = s.mask._startY ? s.mask._startY() : s.mask.startY();
if (my > h) {
return 0;
}
mh = s.mask.getHeight();
if (my + mh > h) {
return h - my;
} else {
return mh;
}
}
return h;
},
/** @language english
* Text animation
* @method wind
* @since 1.3.0
* @public
* @example
* LInit(50, "legend", 800, 480, main);
* function main () {
* var theTextField = new LTextField();
* theTextField.text = "wait click";
* theTextField.x = 10;
* theTextField.y = 10;
* theTextField.size = 20;
* addChild(theTextField);
* var button = new LButtonSample1("wind test start");
* button.textField = theTextField;
* button.x = 10;
* button.y = 100;
* addChild(button);
* button.addEventListener(LMouseEvent.MOUSE_DOWN, onclick);
* }
* function windOver(event){
* var theTextField = event.target;
* theTextField.removeEventListener(LTextEvent.WIND_COMPLETE, windOver);
* theTextField.text = "wind over";
* }
* function onclick(event){
* var theTextField = event.currentTarget.textField;
* if (theTextField.hasEventListener(LTextEvent.WIND_COMPLETE)) {
* theTextField.removeEventListener(LTextEvent.WIND_COMPLETE, windOver);
* }
* theTextField.text = "TEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT";
* theTextField.speed = 3;
* theTextField.wind();
* theTextField.addEventListener(LTextEvent.WIND_COMPLETE, windOver);
* }
* @examplelink <p><a href="../../../api/LTextField/wind.html" target="_blank">Try it »</a></p>
*/
wind : function (listener) {
var s = this;
s.wind_over_function = listener;
s.windRunning = true;
s._ll_wind_text = s.text;
s.text = "";
s._ll_wind_length = 0;
},
_ll_windRun : function () {
var s = this;
if (s._speedIndex++ < s.speed) {
return;
}
s._speedIndex = 0;
if (s._ll_wind_length > s._ll_wind_text.length) {
s.windRunning = false;
if (s.wind_over_function) {
s.wind_over_function();
}
s.dispatchEvent(new LEvent(LTextEvent.WIND_COMPLETE));
return;
}
s.text = s._ll_wind_text.substring(0, s._ll_wind_length);
s._ll_wind_length++;
},
/** @language english
* <p>Frees memory that is used.</p>
* @method clearShape
* @since 1.0.0
* @public
*/
die : function () {
LMouseEventContainer.removeInputBox(this);
}
};
for (var k in p) {
LTextField.prototype[k] = p[k];
}
return LTextField;
})();
/** @language english
* Dispatched after a LTextField object gains focus.
* <p><a href="LFocusEvent.html#property_FOCUS_IN">LFocusEvent.FOCUS_IN</a></p>
* @event LFocusEvent.FOCUS_IN
*/
/** @language english
* Dispatched after a LTextField object loses focus.
* <p><a href="LFocusEvent.html#property_FOCUS_OUT">LFocusEvent.FOCUS_OUT</a></p>
* @event LFocusEvent.FOCUS_OUT
*/
/** @language english
* Disabled.
* @event LMouseEvent.MOUSE_DOWN
*/
/** @language english
* Disabled.
* @event LMouseEvent.MOUSE_UP
*/
/** @language english
* Disabled.
* @event LMouseEvent.MOUSE_MOVE
*/
/** @language english
* Disabled.
* @event LMouseEvent.MOUSE_OUT
*/
/** @language english
* Disabled.
* @event LMouseEvent.MOUSE_OVER
*/
/** @language english
* Disabled.
* @event LMouseEvent.DOUBLE_CLICK
*/