Packagenet.guttershark.util
Classpublic final class TextFieldUtils

The TextFieldUtils class is a singleton that has utility methods for common operations with TextFields.



Public Methods
 MethodDefined by
  
create(name:String, x:Number, y:Number, w:Number, h:Number, selectable:Boolean = false, multiline:Boolean = false, border:Boolean = false, embedFonts:Boolean = false, autoSize:String = "left"):TextField
Create a TextField.
TextFieldUtils
  
deselect(tf:TextField):void
Deselect a text field.
TextFieldUtils
  
focusAndSelectAll(stage:Stage, tf:TextField):void
Set the stage focus to the target text field and select all text in it.
TextFieldUtils
  
[static] Singleton access.
TextFieldUtils
  
restrictLettersAndNumbers(tf:TextField):void
Restrict a text field to letters (lower/upper) and numbers only.
TextFieldUtils
  
restrictToClassPaths(tf:TextField):void
Restrict a text field to class path characters only (a-zA-Z0-9_.).
TextFieldUtils
  
restrictToEmail(tf:TextField):void
Restrict a text field to email only characters.
TextFieldUtils
  
selectAll(tf:TextField):void
Select all the text in a text field.
TextFieldUtils
  
setLeading(tf:TextField, space:Number = 0):void
Sets the TextField leading formatting.
TextFieldUtils
Method detail
create()method
public function create(name:String, x:Number, y:Number, w:Number, h:Number, selectable:Boolean = false, multiline:Boolean = false, border:Boolean = false, embedFonts:Boolean = false, autoSize:String = "left"):TextField

Create a TextField.

Parameters
name:String — The textfield's name.
 
x:Number — The x position.
 
y:Number — The y position.
 
w:Number — The width.
 
h:Number — The height.
 
selectable:Boolean (default = false) — Whether or not the new text field should be selectable.
 
multiline:Boolean (default = false) — Whether or not the new text field is multiline.
 
border:Boolean (default = false) — Whether or not to show the 1 px black border around the new textfield.
 
embedFonts:Boolean (default = false) — Whether or not to embed fonts.
 
autoSize:String (default = "left") — The autosize value.

Returns
TextField
deselect()method 
public function deselect(tf:TextField):void

Deselect a text field.

Parameters
tf:TextField — The TextField to deselect.
focusAndSelectAll()method 
public function focusAndSelectAll(stage:Stage, tf:TextField):void

Set the stage focus to the target text field and select all text in it.

Parameters
stage:Stage — The stage instance.
 
tf:TextField — The text field.
gi()method 
public static function gi():TextFieldUtils

Singleton access.

Returns
TextFieldUtils
restrictLettersAndNumbers()method 
public function restrictLettersAndNumbers(tf:TextField):void

Restrict a text field to letters (lower/upper) and numbers only.

Parameters
tf:TextField — The text field to restrict.
restrictToClassPaths()method 
public function restrictToClassPaths(tf:TextField):void

Restrict a text field to class path characters only (a-zA-Z0-9_.).

Parameters
tf:TextField — The text field to restrict.
restrictToEmail()method 
public function restrictToEmail(tf:TextField):void

Restrict a text field to email only characters.

Parameters
tf:TextField — The text field to restrict.
selectAll()method 
public function selectAll(tf:TextField):void

Select all the text in a text field.

Parameters
tf:TextField — The TextField to select all in.
setLeading()method 
public function setLeading(tf:TextField, space:Number = 0):void

Sets the TextField leading formatting.

Parameters
tf:TextField — The textfield.
 
space:Number (default = 0) — The leading space.