CoreTextField

Kind of class:class
Inherits from:CoreMovieClip < MovieClip
Known subclasses:
Version:07/19/07
Author:Aaron Clinger, Mike Creighton
Classpath:org.casalib.textfield.CoreTextField
File last modified:Monday, 01 December 2008, 13:34:40
CoreTextField is actually a CoreMovieClip class that uses composition to emulate the standard Flash TextField class. By doing this, it is now possible to extend TextFields where it would otherwise be impossible due to the limitations of TextField instantiation in AS 2.0. All TextField classes should extend from here.
Example:
  • var myText_mc:CoreTextField = CoreTextField.create(this, "text_mc", null, 250, 50);
    this.myText_mc.border = this.myText_mc.background = true;
    this.myText_mc.text = "Hello World!";
Usage note:
  • If you are wanting to set focus to the CoreTextField use setFocus instead of Selection.setFocus().

Summary


Instance properties
  • width : Number
    • The width of the TextField in pixels.
  • height : Number
    • The height of the TextField in pixels.
Class methods
  • create (target:MovieClip, instanceName:String, depth:Number, width:Number, height:Number) : CoreTextField
    • Creates an empty instance of the CoreTextField class.
Class methods inherited from CoreMovieClip
Instance methods
  • setFocus : Boolean
    • Gives focus to the TextField if the TextField is type "input".
  • removeTextField : Void
    • Removes the TextField after automatically calling destroy.
  • destroy : Void

Instance properties

height

height:Number
(read,write)

The height of the TextField in pixels.
Usage note:
  • Always use height instead of _height to properly get/set the TextField's height.

width

width:Number
(read,write)

The width of the TextField in pixels.
Usage note:
  • Always use width instead of _width to properly get/set the TextField's width.

Class methods

create

static function create (
target:MovieClip, instanceName:String, depth:Number, width:Number, height:Number) : CoreTextField

Creates an empty instance of the CoreTextField class. Use this instead of a traditional new constructor statement due to limitations of ActionScript 2.0.
Parameters:
target :
Location where the TextField should be attached.
instanceName:
A unique instance name for the TextField.
depth :
[optional] The depth level where the TextField is placed; defaults to next highest open depth.
width :
A positive integer that specifies the width of the new text field.
height :
A positive integer that specifies the height of the new text field.
Returns:
  • Returns a reference to the created instance.
Example:
  • var myText_mc:CoreTextField = CoreTextField.create(this, "text_mc", null, 250, 50);
Since:
  • Flash Player 7

Instance methods

destroy

function destroy (
) : Void

removeTextField

function removeTextField (
) : Void

Removes the TextField after automatically calling destroy.
Usage note:
  • removeTextField and destroy work identically; you can call either method to destroy and remove the TextField.

setFocus

function setFocus (
) : Boolean

Gives focus to the TextField if the TextField is type "input".
Returns:
  • Returns true if the focus attempt was successful; otherwise false.