First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: Patrick Mineault

Adding the ActionScript

The first thing you'll want to do is load the text into the text box using ActionScript. Select containerMC and go to the « Object Actions » panel. You can make this panel appear by pressing Ctrl+Alt+A, or by pressing the arrow icon at the bottom right of the Flash window.

Now click on the arrow at the top right of the « Object Actions » panel, and select Expert Mode from the drop-down menu. This will allow you to edit the code directly, instead of having to « fill in the blanks ». Copy and paste this script inside of the window:

onClipEvent (load){

	daTextBox = "Insert text here";

You'll need to replace « Insert text here » with your own text ( which you pasted into Notepad, remember?) .

Note the use of onClipEvent(load) here. Everything that is placed inside a load clip event will be executed only once, when the clip is loaded.

Now that this is done, we have to figure out a way to keep track of whether we should scroll the text up or down, or do nothing at all. So we'll add these actions to the buttons:

Up button:

on( press ){

	scrolling = "up";

on( release, releaseOutside ){

	scrolling = 0;


Down button:

on( press ){

	scrolling = "down";

on( release, releaseOutside ){

	scrolling = 0;


So what's happening here is pretty simple: when one of the buttons is pressed, the variable «scrolling» is set to "up" or "down", depending on the button. When the button is released, the variable is set to 0, which is the programmatic equivalent of "no".

Now that we know where we should scroll, it's time to actually do the scrolling. Dynamic text boxes have two properties: scroll and maxscroll. Each of the text lines is numbered, starting with 1. The scroll property is the number of the first line that is shown; you can change its value to get a scrolling effect. Maxscroll is the maximum value of scroll, that is, the total number of lines minus the number of lines shown at once; this one can't be set, just read.

Now, we want the scrolling to occur at regular intervals, so we'll have to execute a few lines of code repeatedly, with a certain amount of time in between every execution. To do this, we'll use the *very* useful onClipEvent( enterFrame ) action. Everything that is inside an enterFrame clip event is executed every single frame.

Knowing all of this, we can add the following script inside of containerMC's actions, below the « load the text » code:

onClipEvent (enterFrame){

	if( scrolling == "up"){



	if( scrolling == "down"){




Simple, isn't it? If you're not familiar with the use of ++ and --, here's a brief explanation. ++ adds 1 to the value of the variable or property it affects; this is known as incrementing the value. --, on the other hand, subtracts 1 from the value of a variable; this is called decrementing a value.

If you test your movie now, you should see the scroller work!

» Level Basic

Added: 2001-06-20
Rating: 8 Votes: 400
(10 being the highest)
» Author
No details available.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.