Flash CS3 Documentation |
|||
| Developing Flash Lite 1.x Applications > Working with Text and Fonts > Creating scrolling text | |||
Flash Lite 1.1 supports the scroll and maxscroll text field properties, which let you create scrolling text fields. The scroll property specifies the first visible line in a text block; you can get and set its value. For example, the following code scrolls the text field whose variable name is story_text down by five lines:
story_text.scroll += 5;
The maxscroll property specifies the first visible line in a text block when the last line of the text is visible in the text block; this property is read-only. You can compare a text field's maxscroll property to its scroll property to determine how far a user has scrolled within a text field. This is useful if you want to create a scroll bar that provides feedback about the user's current scroll position relative to the maximum scroll position.
For more information about creating documents from device templates, see Using Flash Lite document templates in Getting Started with Flash Lite 1.x.
story with the text field.
This button acts as key catcher button, and it doesn't need to be visible to the user. For more information about creating key catcher buttons, see Creating a key catcher button.
on(keyPress "<Down>") {
story.scroll++;
}
on(keyPress "<Up>") {
story.scroll--;
}
Press the Up and Down Arrow keys on your keyboard (or the Up and Down buttons on the emulator's keypad) to scroll the text up or down.
For simplicity, this example lets you enter the text field's content in the authoring tool. But you can easily modify the example so that the text field's content is updated using ActionScript. To do this, you would write ActionScript that assigns the desired text to the variable name that you assigned to the multiline text field (story, in this example).
story = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed ipsum. Nam tempus. Nullam sed velit eget sem consectetuer tempor. Morbi eleifend venenatis pede. Cras ac lorem eget massa tincidunt iaculis...etc."
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00005666.html