Return to Kroll Design home page

Flash Tutorials (with .FLA files included)

« Return

ActionScript 2

component: ScrollPane

Flash comes with what are called "components" or "compiled clips". These widgets contain embedded code but can be customized. One such component is ScrollPane -- a rectangular box in which you can place content. If there is more content than will display at once, the ScrollPane includes a horizontal and/or vertical scrollbar. This example shows how to add a ScrollPane that contains text which you can scroll.

Download the FLA file

// myScrollPane is an instance of ScrollPane that I dragged
// from the component library onto the stage and gave an
// instance name of myScrollPane.
// To assign content such as text to a ScrollPane component,
// set the "contentPath" property of the ScrollPane to the 
// movie clip name which contains the content, in this example,
// the content is stored in a movie clip I created called
// TextMovieClip. If you edit TextMovieClip, you'll see that I
// gave it an x and y position of 10 pixels, to give it a little
// space on the left and top when it's pulled into myScrollPane. 
// I also had to add a few blank lines after the text within the 
// text box, so that the vertical scroll bar works correctly and shows
// the last of the text when I scroll all the way down.

   myScrollPane.contentPath = "TextMovieClip";

« Return

©2012 Kroll Design    781.910.3694
Last modified: 12/31/1969 7:00 PM