TAILIEUCHUNG - Using TextFormat Objects

Sử dụng TextFormat Đối tượng sử dụng các thẻ HTML trong chuỗi văn bản (như trong Bài Học 12, "Sử dụng XML với Flash") không phải là cách duy nhất để văn bản phong cách năng động: các đối tượng TextFormat cung cấp tất cả sức mạnh của định dạng HTML, và nhiều hơn nữa! Như không có gì hơn các đối tượng đặc biệt có chứa các định dạng bất động sản cho nhân vật và phong cách đoạn, TextFormat đối tượng cung cấp chức năng tương tự như của Cascading Style Sheets (CSS) | Using TextFormat Objects Using HTML tags in strings of text as in Lesson 12 Using XML with Flash is not the only way to style text dynamically TextFormat objects provide all the formatting power of HTML and more As nothing more than special objects containing formatting properties for character and paragraph styles TextFormat objects offer functionality similar to that of Cascading Style Sheets CSS . After a TextFormat object has been defined that object is then applied to a text field or section of text in a field causing the affected text to take on the formatting style described by the object. A TextFormat object can be created and defined in one of two ways. Look at the following syntax var myStyle TextFormat new TextFormat nameOfFont size color bold italic In this syntax a TextFormat object is created and its formatting settings configured simultaneously. Here s an example var myStyle TextFormat new TextFormat Arial 12 0x336699 true true TIP You can configure many additional formatting settings by using the constructor function. The preceding syntax creates a TextFormat object named myStyle. This object represents a format that uses the Arial font at a point size of 12 using the color blue and in bold italic. If you create the same TextFormat object using the alternative syntax here s how it would look var myStyle TextFormat new TextFormat with myStyle font Arial size 12 color 0x336699 bold true italic true The preceding syntax uses a with statement to configure various formatting properties of the newly created object. Either way works but the latter syntax is generally easier to read and use. After you ve created a TextFormat object you can apply it to all or just a portion of the current text in the field or to any new text entered into the field. To apply a TextFormat object to all the text in a text field use the following syntax myStyle This script causes all text in the myField_txt text field to be displayed in the formatting .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.