tailieunhanh - Học Actionscript 3.0 - p 32

Text Layout Framework Flowing text across multiple containers The last example of the chapter is the most advanced and demonstrates one of TLF’s most powerful features: the ability to flow text across multiple containers. This is called linked text, or threaded text, because the text is not broken apart when populating more than one text field. Instead, it flows through linked text fields, threading its way through your layout. This is further demonstrated with selectable linked text and the ability to scroll within a field while selecting text—just like you can in a text editor. One of the first things you’re likely. | Text Layout Framework Flowing text across multiple containers The last example of the chapter is the most advanced and demonstrates one of TLF s most powerful features the ability to flow text across multiple containers. This is called linked text or threaded text because the text is not broken apart when populating more than one text field. Instead it flows through linked text fields threading its way through your layout. This is further demonstrated with selectable linked text and the ability to scroll within a field while selecting text just like you can in a text editor. One of the first things you re likely to notice is that this script contains no direct reference to TLF text fields. Instead it uses the concept of TLF containers sprites or movie clips that are automatically populated with TLF text by Flash Player. This approach is very powerful because it means that anywhere you can create a sprite you can fill it with TLF text and even link it up as part of a chain of TLF text. For example you could create many text fields across the stage and size them all to accommodate one line of text. You could then link them together flow The Rime of the Ancient Mariner through them and animate them up and down like undulating waves of water. Best of all you can easily reflow the text along the linked chain whenever required. The following code is found in the source file. Lines 1 through 6 import all the classes required to complete this exercise. 1 import 2 import 3 import 4 import 5 import 6 import Lines 8 through 16 fill the field with text. Lines 8 through 12 create a string of TLF markup. Lines 9 and 12 open and close the TextFlow content and lines 10 and 11 use the dummyText function found in