Creating scrolling text

There are several ways to create scrolling text in Flash. You can make dynamic and input text fields scrollable by selecting the Scrollable Mode option in the Text menu or the context menu, or by Shift-double-clicking the text block handle.

You can use the scroll and maxscroll properties of the TextField object to control vertical scrolling and the hscroll and maxhscroll properties to control horizontal scrolling in a text block. The scroll and hscroll properties specify the current vertical and horizontal scrolling positions, respectively; you can read and write these properties. The maxscroll and maxhscroll properties specify the maximum vertical and horizontal scrolling positions, respectively; you can only read these properties.

The TextArea component in Flash MX 2004 provides an easy way to create scrolling text fields with a minimum of scripting. For more information, see TextArea component.

To create a scrollable dynamic text block, do one of the following:

To use the scroll property to create scrolling text:

  1. Do one of the following:
    • Use the Text tool to drag a text field on the Stage. Assign the text field the instance name textField in the Property inspector.
    • Use ActionScript to create a text field dynamically with the MovieClip.createTextField() method. Assign the text field the instance name textField as a parameter of the method.
  2. Create an Up button and a Down button, or select Window > Other Panels > Common Libraries > Buttons and drag buttons to the Stage.

    You will use these buttons to scroll the text up and down.

  3. Select the Down button on the Stage.
  4. In the Actions panel (Window > Development Panels > Actions), enter the following code to scroll the text down in the text field:
    on(press) {
      textField.scroll += 1;
    }
    
  5. Select the Up button on the Stage.
  6. In the Actions panel, enter the following code to scroll the text up:
    on(press) {
      textField.scroll += 1;
    }