ActionScript 2.0 Components Language Reference |
|
|
|
| ScrollPane component > ScrollPane.vPosition | |||
Flash Player 6 (6.0.79.0).
Flash MX 2004.
scrollPaneInstance.vPosition
Property; orients the scroll pane's contents in pixels, and adjusts the vertical scroll box (thumb) proportionally. The 0 position is at the top end of the scroll track, which causes the top edge of the scroll pane content to be visible in the scroll pane. The default value is 0.
This example creates a ScrollPane instance called my_sp, loads it with an image, and creates a listener to handle the scroll event and display the horizontal (hPosition) and vertical (vPosition) scroll positions as the user clicks the scroll bar.
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):Void {
trace("hPosition = " + my_sp.hPosition + ", vPosition = " + my_sp.vPosition);
};
// Add listener.
my_sp.addEventListener("scroll", spListener);
|
|
|
|