User Guide
ScrollPane component 669
contentPath indicates the content to load into the scroll pane. This value can be a relative path to
a local SWF or JPEG file, or a relative or absolute path to a file on the Internet. It can also be the
linkage identifier of a movie clip symbol in the library that is set to Export for ActionScript.
hLineScrollSize indicates the number of units a horizontal scroll bar moves each time an arrow
button is clicked. The default value is 5.
hPageScrollSize indicates the number of units a horizontal scroll bar moves each time the track
is clicked. The default value is 20.
hScrollPolicy displays the horizontal scroll bars. The value can be on, off, or auto. The default
value is
auto.
scrollDrag is a Boolean value that determines whether scrolling occurs (true) or not (false)
when a user drags on the content within the scroll pane. The default value is
false.
vLineScrollSize indicates the number of units a vertical scroll bar moves each time a scroll arrow
is clicked. The default value is 5.
vPageScrollSize indicates the number of units a vertical scroll bar moves each time the scroll bar
track is clicked. The default value is 20.
vScrollPolicy displays the vertical scroll bars. The value can be on, off, or auto. The default
value is
auto.
You can write ActionScript to control these and additional options for a ScrollPane component
using its properties, methods, and events. For more information, see “ScrollPane class”
on page 671.
Creating an application with the ScrollPane component
The following procedure explains how to add a ScrollPane component to an application while
authoring. In this example, the scroll pane loads a SWF file that contains a logo.
To create an application with the ScrollPane component:
1.
Drag a ScrollPane component from the Components panel to the Stage.
2.
In the Property inspector, enter the instance name myScrollPane.
3.
In the Property inspector, enter logo.swf for the contentPath parameter.
4.
Select Frame 1 in the Timeline, open the Actions panel, and enter the following code:
scrollListener = new Object();
scrollListener.scroll = function (evt){
txtPosition.text = myScrollPane.vPosition;
}
myScrollPane.addEventListener("scroll", scrollListener);
completeListener = new Object;
completeListener.complete = function() {
trace("logo.swf has completed loading.");
}
myScrollPane.addEventListener("complete", completeListener);