The TextField and TextFormat Classes

     

The TextField and TextFormat Classes

Table A.12. TextField Attributes, Methods, and Events

Name

Method/Attribute/Event/

Format

Description

addListener

M

myTextField.addListener (myObject)

Registers myObject to receive notification of onChanged and onScroller events associated with myTextField .

getDepth

M

myTextField.getDepth()

Returns the depth of myTextField .

getFontList

M

TextField.getFontList()

Returns an array of font names . Note: TextField , not myTextField .

getNewTextFormat

M

myTextField.getNewTextFormat()

Returns a copy of the TextFormat object applied to new text inserted in myTextField manually or using replaceSel() .

removeListener

M

myTextField.removeListener(myObject)

Removes myObject from the array of listeners associated with myTextField , that is, cancels myTextField.addListener(myObject) .

removeTextField

M

myTextField.removeTextField()

Removes myTextField , if it was created with MovieClip.create TextField() .

setNewTextFormat

M

myTextField.setNewTextFormat (myTextFormat)

Sets myTextFormat as the text format object for new text inserted in myTextField manually or using replaceSel() .

replaceSel

M

myTextField.replaceSel( newText )

Substitutes the newText string for currently selected text.

setTextFormat

M

myTextField.setTextFormat (myTextFormat)

Assigns myTextFormat to text that is already in myTextField .

_alpha

A

myTextField._alpha

The transparency value of myTextField , an integer from to 100 .

autoSize

A

myTextField.autoSize

A string specifying the anchor point for myTextField when it is being automatically resized to fit text. See Table A.13.

background

A

myTextField.background

A Boolean that shows ( true ) or hides ( false ) background fill.

backgroundColor

A

myTextField.backgroundColor

Specifies the color of the background fill. An integer, often in hexadecimal format, for example, 0xFF0000.

border

A

myTextField.border

A Boolean that specifies whether the text field has a border.

borderColor

A

myTextField.borderColor

Specifies the color of the border. An integer, often in hexa decimal format, for example, 0xFF0000.

bottomScroll

A

myTextField.bottomScroll

A read-only integer specifying the bottommost line in myTextField that is visible.

condenseWhite

A

myTextField. condenseWhite

A Boolean that specifies whether "white space" (including spaces, line breaks, and paragraph breaks) are removed from HTML text. Ignored if html attribute is false .

embedFonts

A

myTextField.embedFonts

A Boolean that specifies whether the text field uses embedded font outlines ( true ) or device fonts ( false ).

_focusrect

A

myTextField._focusrect

A Boolean that specifies whether a text field has a yellow rectangle around it when it has focus.

_highquality

A

TextField._highquality

References the global _highquality variable. Globally enables smoothing bitmaps and antialiasing. An integer. : none. 1 : antialias, smooth bitmaps if no animation in movie (default). 2 : smooth bitmaps and antialias.

_height

A

myTextField._height

A read-write integer, the height of myTextField in pixels. Affects bounding box size only, not font size .

hscroll

A

myTextField.hscroll

An integer that specifies, in pixels, the current horizontal scroll position of myTextField .

html

A

myTextField.html

A Boolean that specifies whether myTextField contains HTML text. Must precede myTextField.htmlText .

htmlText

A

myTextField.htmlText

A string containing HTML-formatted text for myTextField .

length

A

myTextField.length

A read-only integer, the number of characters in myTextField .

maxChars

A

myTextField.maxChars

An integer. When myTextField contains this number of characters, Flash disables manual insertion of characters.

maxhscroll

A

myTextField.maxhscroll

A read-only integer value that specifies, in pixels, the maximum possible value of myTextField.hscroll , given the current text.

maxscroll

A

myTextField.maxscroll

A read-only integer value that specifies, in pixels, the maximum possible value of myTextField.scroll , given the current text.

multiline

A

myTextField.multiline

A Boolean that specifies whether myTextField can contain multiple lines.

_name

A

myTextField._name

A string, the instance name, for example, "myTextField" .

_parent

A

myTextField._parent

A reference to the movie clip or button that is myTextField 's parent.

password

A

myTextField.password

A Boolean that specifies whether myTextField is a password field. If it is true , Flash displays asterisks on the screen instead of input characters.

_quality

A

TextField._quality

Global string attribute, specifies the rendering quality of a movie. LOW : Graphics not antialiased; bitmaps not smoothed. MEDIUM : Graphics antialiased using a 2 x 2 pixel grid; bitmaps not smoothed. Suitable for movies with no text. HIGH : Graphics antialiased using a 4 x 4 pixel grid; bitmaps smoothed if no animation in movie. ( HIGH is the default.) BEST : Graphics antialiased using a 4 x 4 pixel grid; bitmaps always smoothed.

restrict

A

myTextField.restrict

A string specifying the set of characters that a user can enter into myTextField . A dash indicates a range. A caret ( ^ ) means the following characters are excluded, whereas preceding characters are allowed. The following example includes only lowercase letters , but excludes the lowercase letter w : myTextField.restrict = "a-z^w";

_rotation

A

myTextField._rotation

A read-write integer value that specifies the current degree of rotation of myTextField .

scroll

A

myTextField.scroll

A read-write integer value that specifies the current vertical scrolling position of myTextField , measured in lines of text.

selectable

A

myTextField.selectable

Boolean, specifies whether myTextField is selectable.

_soundbuftime

A

myTextField._soundbuftime

References the global _sound buftime variable. Globally sets and gets the amount of time, in seconds, a sound must prebuffer before it streams. An integer, defaulting to 5 .

tabEnabled

A

myTextField.tabEnabled

A Boolean that specifies myTextField is included in automatic tab ordering.

tabIndex

A

myTextField.tabIndex

Specifies the tab order of myTextField .

text

A

myTextField.text

A read-write string, the current text in the text field.

textColor

A

myTextField.textColor

A read-write integer, the color of the current text in the text field. Often in hex format, such as 0xFF0000.

textHeight

A

myTextField.textHeight

A read-only integer value that specifies the height of the actual text (not the bounding box).

textWidth

A

myTextField.textWidth

A read-only integer value that specifies the width of the actual text (not the bounding box).

type

A

myTextField.type

A read-write string, dynamic or input , that specifies whether myTextField is an input text field or dynamic text field.

_url

A

myTextField._url

A read-only string, the URL of the SWF file that created the text field instance.

variable

A

myTextField.variable

A read-write string, the variable name associated with the text field.

_visible

A

myTextField._visible

A read-write Boolean value that determines whether myTextField is hidden ( false ) or visible ( true ).

_width

A

myTextField._width

A read-write integer, the width of myTextField in pixels. This affects only the bounding box of the text field; it does not affect the border thickness or text font size.

wordWrap

A

myTextField.wordWrap

A read-write Boolean that specifies whether the text field word-wraps.

_x

A

myTextField._x

A read-write integer, the x coordinate of myTextField .

_xmouse

A

myTextField._xmouse

A read-only integer, the x coordinate of the cursor relative to myTextField .

_xscale

A

myTextField._xscale

A read-write integer from -100 to 100 , specifying the percentage for horizontally scaling myTextField .

_y

A

myTextField._y

A read-write integer, the y coordinate of myTextField .

_ymouse

A

myTextField._ymouse

A read-only integer, the y coordinate of the cursor relative to myTextField .

_yscale

A

myTextField._yscale

A read-write integer from -100 to 100 , specifying the percentage for vertically scaling myTextField .

onChanged

E

myTextField.onChanged = function ( textfieldName ) {}

Invoked when the text in the field is changed.

onKillFocus

E

myTextField.onKillFocus = function ( newFocus ) {}

Invoked when the text field loses focus.

onScroller

E

myTextField.onScroller = function ( textfieldName ) {}

Invoked when the scroll , maxscroll , hscroll , maxhscroll , or bottomscroll attribute of myTextField changes.

onSetFocus

E

myTextField.onSetFocus = function ( oldFocus ) {}

Invoked when the text field receives focus.


Table A.13. TextField.autoResize Values

Value

Single Line

Multiline

"none" or false

Do not automatically resize

Do not automatically resize

"left" or true

Expand right

Expand bottom

"center"

Expand right and left

Expand bottom

"right"

Expand left

Expand bottom


Table A.14. TextFormat Attributes and Methods

Name

Method/Attribute

Format

Description

getTextExtent

M

myTextFormat.getTextExtent ( text )

Returns an object with two attributes, width and height , that indicate the dimensions in points of the text string when formatted with myTextFormat . (Width may be inaccurate with embedded fonts.)

align

A

myTextFormat.align

A string indicating text alignment: null , "left" , "right" , or "center" .

blockIndent

A

myTextFormat.blockIndent

An integer specifying, in points, an amount to indent all lines in a block of text.

bold

A

myTextFormat.bold

A Boolean indicating whether text is boldface.

bullet

A

myTextFormat.bullet

A Boolean indicating whether to format text in a bulleted list.

color

A

myTextFormat.color

An integer specifying the color of text. Often in hexadecimal format, for example, 0xFF0000.

font

A

myTextFormat.font

A string specifying the font name, for example, New Times Roman .

indent

A

myTextFormat.indent

An integer specifying, in points, the indentation from the left margin to the first character in each paragraph.

italic

A

myTextFormat.italic

A Boolean indicating whether text is italicized.

leading

A

myTextFormat.leading

An integer specifying, in points, the amount of leading (vertical space between lines).

leftMargin

A

myTextFormat.leftMargin

An integer specifying the left margin, in points.

rightMargin

A

myTextFormat.rightMargin

An integer specifying the right margin, in points.

tabStops

A

myTextFormat.tabStops

An array of positive integers specifying custom tab stops.

target

A

myTextFormat.target

Used with myTextFormat.url . A string specifying the browser window in which to display the hyperlinked page. Values match those of the HTML target attribute, for example, "_blank" , "_self" , "_top" , "_parent" .

size

A

myTextFormat.size

An integer specifying, in points, the size of the text.

underline

A

myTextFormat.underline

A Boolean indicating whether text is underlined .

url

A

myTextFormat.url

A string specifying the URL to which the text links.


Table A.15. StyleSheet Methods and Events

Name

Method/Event

Format

Description

getStyle

M

myStyleSheet.getStyle ("myStyleName")

Returns a copy of the style sheet object associated with the myStyleName style.

getStyleNames

M

myArray = myTextField.myStyleSheet.getStyleNames()

Returns an array that contains the names of all the styles registered in the style sheet object.

load

M

myStyleSheet.load ("gdStyles.css")

Begins loading the external gdStyles.css style sheet into the myStyleSheet object. Requires complete path to external style sheet.

parseCSS

M

myStyleSheet.parseCSS (textToParse)

Parses a string of CSS text ( textToParse ) and creates the specified style.

setStyle

M

myStyleSheet.setStyle ("bodyText", {

 fontsize: '12px'}); 

Adds a new style ( bodyText ) to the style sheet object, with the specified CSS properties.

onLoad

E

myStyleSheet.onLoad( )

Callback handler invoked when a TextField.StyleSheet.load() operation has completed.




Using Macromedia Studio MX 2004
Special Edition Using Macromedia Studio MX 2004
ISBN: 0789730421
EAN: 2147483647
Year: N/A
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net