Two classes related to textboxes and their formatting:
MbTextField extends TextField
use | constructors | vars | events | get/set
Use
//puts a textfield in the center of a 100x100 square
graphics.beginFill(0xc807c8);
graphics.drawRect(0,0,100,100);
graphics.lineStyle(1, 0xff0000);
graphics.moveTo(50,0); graphics.lineTo(50, 100);
graphics.moveTo(0,50); graphics.lineTo(100, 50);
var tf:MbTextField = new MbTextField("MathBench", 50, 50);
tf.border = true; tf.background = true;
tf.backgroundColor = 0xffffff;
tf.setCorner("mid", "mid");
addChild(tf);
Constructor
MbTextField(txt_:String, x_:Number, y_:Number)
defaults:
this.defaultTextFormat = MbFormat.makeFormat("appTitle");
this.format = MbFormat.makeFormat("appDirections");
this.selectable = false;
this.multiline = true;
this.wordWrap = false;
refreshMe();
Inherited Events
TextEvent.CHANGE
after every keystroke
TextEvent.TEXT_INPUT
not sure how this is different
Inherited variables
text
Booleans: border, background, multiline, wordWrap
Colors: borderColor, backgroundColor
About the text: length, maxChars, numLines, htmlText
About the cursor: selectable, selectionBeginIndex, selectionEndIndex, caretIndex
To restrict enterable characters: restrict
ex: restrict = "0123456789,.-"
Read only: textWidth, textHeight
about Scrolling:
text can scroll, but there are no arrows, thumb, etc to guide user
Getters/Setters
setAlign(type:String)
choices: "left" | "center" | "right"
setCorner(v_:String, h_:String)
offers 9 positions that the "x,y" of the textfield can be set to.
choices for v: "top" | "mid" | "bottom"
choices for h: "left" | "mid" | "right"
setColor(col:uint)
setBold(boo:Boolean=true)
MbFormat extends TextFormat
simplifies text formatting a bit, and standardizes font (default: Eras Medium ITC 12px)
static makeFormat(format:String=""):MbFormat
possible predefined formats are "appTitle", "appDirections", "hint" , "grAxes", "grTitle", "testing"
setColor(col:uint) : MbFormat
setBold(boo:Boolean) : MbFormat