Prev | Current Page 621 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

current.createTextField(???text???, 0, 0, 0, 200, 20);
var t : TextField = Reflect.field(Lib.current, ???text???);
#end
t.text = ???Hello World!???;
t.type = ???input???;
// alternatively you can set a text in HTML format
// but first you must tell the TextField to treat it as such
t.html = true;
t.htmlText = ???Hello < b > World! < /b > ???;
}
}
Starting at version 7 it is also possible to set a Cascading Style Sheet (CSS) using the property
TextField.styleSheet and the HTML text can also contain references to embedded media like
movie clips and images.
Chapter 12: Building Interactive Content with Flash
323
Creating a TextField in Flash 9
The TextField class is part of the flash.text package and it can be directly instantiated as it happens
for the MovieClip class. As you can see from the next example, the code reorganization in Flash 9 has
really improved the code usability and readability, and to perform the same actions as in previous
versions, less typing is needed.
import flash.Lib;
import flash.


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