📄 textarea.as
字号:
class mx.controls.TextArea extends mx.core.ScrollView
{
var label, __get__maxChars, __get__restrict, invalidate, __get__wordWrap, __get__editable, __get__password, __get__html, __get__text, initText, dispatchValueChangedEvent, getHPosition, setHPosition, __get__hPosition, getVPosition, setVPosition, __get__vPosition, _color, focusTextField, _parent, owner, hscroll, scroll, __set__text, tfx, tfy, tfw, tfh, doLater, _vpos, _hpos, hookedV, vScroller, hookedH, hScroller, getViewMetrics, __get__width, __get__height, hScrollPolicy, vScrollPolicy, enabled, getStyle, getFocusManager, addEventListener, removeEventListener, _getTextFormat, setScrollProperties, __get__tabIndex, __get___accProps, __get__styleSheet, __set___accProps, __set__editable, __set__hPosition, __set__html, __get__length, __set__maxChars, __get__maxHPosition, __get__maxVPosition, __set__password, __set__restrict, __set__styleSheet, __set__tabIndex, __set__vPosition, __set__wordWrap;
function TextArea()
{
super();
} // End of the function
function get maxChars()
{
return (label.maxChars);
} // End of the function
function set maxChars(x)
{
label.maxChars = x;
//return (this.maxChars());
null;
} // End of the function
function get length()
{
return (label.length);
} // End of the function
function get restrict()
{
return (label.restrict);
} // End of the function
function set restrict(s)
{
label.restrict = s == "" ? (null) : (s);
//return (this.restrict());
null;
} // End of the function
function get wordWrap()
{
return (label.wordWrap);
} // End of the function
function set wordWrap(s)
{
label.wordWrap = s;
this.invalidate();
//return (this.wordWrap());
null;
} // End of the function
function get editable()
{
return (__editable);
} // End of the function
function set editable(x)
{
__editable = x;
label.type = x ? ("input") : ("dynamic");
//return (this.editable());
null;
} // End of the function
function get password()
{
return (label.password);
} // End of the function
function set password(s)
{
label.password = s;
//return (this.password());
null;
} // End of the function
function get html()
{
return (this.getHtml());
} // End of the function
function set html(value)
{
this.setHtml(value);
//return (this.html());
null;
} // End of the function
function getHtml()
{
return (label.html);
} // End of the function
function setHtml(value)
{
if (value != label.html)
{
label.html = value;
} // end if
} // End of the function
function get text()
{
return (this.getText());
} // End of the function
function set text(t)
{
this.setText(t);
//return (this.text());
null;
} // End of the function
function getText()
{
if (initializing)
{
return (initText);
} // end if
var _loc2 = label;
if (_loc2.html == true)
{
return (_loc2.htmlText);
} // end if
return (_loc2.text);
} // End of the function
function setText(t)
{
if (initializing)
{
initText = t;
}
else
{
var _loc2 = label;
if (_loc2.html == true)
{
_loc2.htmlText = t;
}
else
{
_loc2.text = t;
} // end else if
this.invalidate();
} // end else if
this.dispatchValueChangedEvent(t);
} // End of the function
function get hPosition()
{
return (this.getHPosition());
} // End of the function
function set hPosition(pos)
{
this.setHPosition(pos);
label.hscroll = pos;
label.background = false;
//return (this.hPosition());
null;
} // End of the function
function get vPosition()
{
return (this.getVPosition());
} // End of the function
function set vPosition(pos)
{
this.setVPosition(pos);
label.scroll = pos + 1;
label.background = false;
//return (this.vPosition());
null;
} // End of the function
function get maxVPosition()
{
var _loc2 = label.maxscroll - 1;
return (_loc2 == undefined ? (0) : (_loc2));
} // End of the function
function get maxHPosition()
{
var _loc2 = label.maxhscroll;
return (_loc2 == undefined ? (0) : (_loc2));
} // End of the function
function init(Void)
{
super.init();
label.styleName = this;
_color = mx.core.UIObject.textColorList;
focusTextField = label;
label.owner = this;
label.onSetFocus = function (x)
{
_parent.onSetFocus(x);
};
label.onKillFocus = function (x)
{
_parent.onKillFocus(x);
};
label.drawFocus = function (b)
{
_parent.drawFocus(b);
};
label.onChanged = function ()
{
owner.adjustScrollBars();
owner.dispatchEvent({type: "change"});
owner.dispatchValueChangedEvent(owner.text);
};
label.onScroller = function ()
{
owner.hPosition = hscroll;
owner.vPosition = scroll - 1;
};
if (this.__get__text() == undefined)
{
this.__set__text("");
} // end if
} // End of the function
function createChildren(Void)
{
super.createChildren();
label.autoSize = "none";
} // End of the function
function layoutContent(x, y, totalW, totalH, displayW, displayH)
{
var _loc2 = label;
if (tfx != x || tfy != y || tfw != displayW || tfh != displayH)
{
tfx = x;
tfy = y;
tfw = displayW;
tfh = displayH;
_loc2.move(tfx, tfy);
_loc2.setSize(tfw, tfh);
this.doLater(this, "adjustScrollBars");
} // end if
} // End of the function
function scrollChanged(Void)
{
var _loc2 = Selection;
if (_loc2.lastBeginIndex != undefined)
{
this.restoreSelection();
} // end if
label.background = false;
} // End of the function
function onScroll(docObj)
{
var _loc3 = label;
super.onScroll(docObj);
_loc3.hscroll = this.__get__hPosition() + 0;
_loc3.scroll = this.__get__vPosition() + 1;
_vpos = _loc3.scroll;
_hpos = _loc3.hscroll;
_loc3.background = false;
if (hookedV != true)
{
vScroller.addEventListener("scrollChanged", this);
hookedV = true;
} // end if
if (hookedH != true)
{
hScroller.addEventListener("scrollChanged", this);
hookedH = true;
} // end if
} // End of the function
function size(Void)
{
var _loc3 = this.getViewMetrics();
var _loc7 = _loc3.left + _loc3.right;
var _loc4 = _loc3.top + _loc3.bottom;
var _loc6 = _loc3.left;
var _loc5 = _loc3.top;
tfx = _loc6;
tfy = _loc5;
tfw = this.__get__width() - _loc7;
tfh = this.__get__height() - _loc4;
super.size();
label.move(tfx, tfy);
label.setSize(tfw, tfh);
if (this.__get__height() <= 40)
{
hScrollPolicy = "off";
vScrollPolicy = "off";
} // end if
this.doLater(this, "adjustScrollBars");
} // End of the function
function setEnabled(enable)
{
enabled = enable;
vScroller.enabled = enable;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -