Prev | Current Page 620 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

swf -swf-version 9 -main Main --flash-strict -swfheader
280:280:21:ffffff
Text
Text can be displayed in a Flash movie using the TextField class. The class can also be used
to display an input box; to enable this feature, set the type field to input (in Flash 9 use the
TextFieldType.INPUT to be sure to not misspell the value). For a read - only TextField use the
default value dynamic (or TextFieldType.DYNAMIC in Flash 9).
Creating a TextField in Flash 6 to 8
The TextField cannot be directly instantiated and can only be created starting from an existing
MovieClip instance using the createTextField() method. The method accepts as arguments an
instance name, a depth - level, two coordinates, and two dimensions for width and height.
import flash.Lib;
import flash.MovieClip;
import flash.TextField;
class Main
{
public static function main()
{
#if flash8
// in Flash 8, the createTextField() returns a reference
// to the newly created object
var t = Lib.current.createTextField(???text???, 0, 0, 0, 200, 20);
#else flash
// in previous version the create TextField must be referenced
// by name
Lib.


Pages:
608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632