You first drag the ScrollPane component from the Components panel to the current
document's library and then add the following code to Frame 1:
/**
Requires:
- ScrollPane component in library
*/
this.createClassObject(mx.containers.ScrollPane, "my_sp", 10);
my_sp.setSize(360, 280);
System.security.allowDomain("http://www.helpexamples.com");
my_sp.contentPath = "http://www.helpexamples.com/flash/images/image1.jpg";
// Scroll 100 pixels when clicking on horizontal bar.
my_sp.hPageScrollSize = 100;
// Create Listener Object.
var spListener:Object = new Object();
spListener.scroll = function(evt_obj:Object) {
trace("hPosition = " + my_sp.hPosition + ", vPosition = " +
my_sp.vPosition);
}
// Add listener.
my_sp.addEventListener("scroll", spListener);
ScrollPane.hScrollPolicy
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX 2004.
Usage
scrollPaneInstance.hScrollPolicy
Description
Property; determines whether the horizontal scroll bar is always present (
), is never
"on"
present (
), or appears automatically according to the size of the image (
). The
"off"
"auto"
default value is
.
"auto"
Example
The following example creates an instance of a ScrollPane called
, sets
my_sp
hScrollPolicy
to
to prevent a horizontal scroll bar from appearing, and loads it with an image.
off
1112
ScrollPane component
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?
Questions and answers