Flash vertical scrollers are often used as a central building block for Flash games. They can be used to scroll through libraries of selectable game boards, pieces and backgrounds. They also can be set to scroll automatically and continually display a variety of images. One of the most flexible scrolling components in Flash is the ScrollPane component. It can scroll images, text and movie clips. It comes complete with a large number of methods and properties that allow you to customise its appearance and functionality.
- Skill level:
Other People Are Reading
Things you need
- Adobe Flash Professional CS3, CS4 or CS5
Start the Flash program. Click the file type "Flash File (ActionScript 3.0)" from the Flash display screen to create a new Flash project that uses the Flash ActionScript 3 (AS3) programming language.
Click "Tools" from the Window menu to display the drawing tools panel, "Components" to show the Components Library panel and "Component Inspector" to open the Component Inspector panel.
Press and release the "R" key on your keyboard (or select the Rectangle tool in the drawing toolbar) to activate the rectangle drawing tool. Position your mouse cursor on the stage, then click and drag the mouse to draw a rectangle. Release when the rectangle is about 1 inch by 2 inches. Draw four more rectangles directly below the first rectangle so that a column of rectangles is formed.
Press the "V" key on your keyboard (or use the Selection tool in the drawing toolbar) to activate the selection tool. Click and drag a selection rectangle so it completely encloses the column of rectangles you have drawn. Release the mouse button.
Position your mouse over the selected column of rectangles, right-click and select the "Convert to Symbol" option from the context menu to access the Convert to Symbol dialogue box.
Make the following selections in the Convert to Select dialogue box: Select the "MovieClip" option from the "Type" list box; click the centre check box in the "Registration" point icon to align the rectangles to the upper left corner of the ScrollPane; click the "Export for ActionScript" check box; and enter the name "imageCollection" in the Class text box to set the Class name that will be used to access this movie clip in the ActionScript code. Click "OK." Click "OK" again when the ActionScript Class Warning dialogue box appears.
Click the "ScrollPane" component from the Components Library and drag it to the stage. Type the name "firstScroll" in the instance name box of the Components Inspector to set a name that the ActionScript code will use to access the ScrollPane component.
Press the "F9" key on your keyboard to open the Actions editor. Position you mouse cursor on the first line of the editor, click and type the code below to import the ScrollPane utility into Flash, import the first Scroll movie clip (symbol) into the first Scroll ScrollPane and set the ScrollPane's width and height to 100 pixels each.
firstScroll.source = image Collection;
Depress the "Ctrl" key on your keyboard, then press and release the "Enter" key and the "Ctrl" key on your keyboard to play the ScrollPane Flash movie. Click in the horizontal and vertical scroll bars in the ScrollPane to view the other rectangles in the ScrollPane.
Tips and warnings
- If you don't set the registration point in the upper left-hand corner when you convert the rectangles to a movie clip (symbol), you won't be able to scroll the entire movie clip. If you set the size of the ScrollPane larger than the size of the movie clip, the scroll bars won't be visible (since you will be able to see the entire movie clip in the ScrollPane).
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for
- YouTube: Flash AS3 ScrollPane Component Tutorial: Scrolling Custom Movieclips; 2009
- ilike2Flash: Using the Scrollpane Component; May 2008
- Adobe: Using ActionScript 3.0 Components; Use the ScrollPane Component
- Adobe: ActionScript 3.0 Reference for the Adobe® Flash® Platform; ScrollPane
- Adobe: Using Adobe ActionScript 3.0 Components; Customize the ScrollPane Component