Customizing The Scrollpane Component - MACROMEDIA FLASH 8-COMPONENTS LANGUAGE Reference

Components language reference
Table of Contents

Advertisement

3.
Select Frame 1 in the main Timeline, open the Actions panel, and enter the following code:
/**
Requires:
- ScrollPane in library
*/
System.security.allowDomain("http://www.helpexamples.com");
this.createClassObject(mx.containers.ScrollPane, "my_sp", 10);
my_sp.setSize(320, 240);
// Create listener object for scroll vertical position.
var scrollListener:Object = new Object();
scrollListener.scroll = function(evt_obj:Object) {
trace("hPosition: " + my_sp.hPosition + ", vPosition = " +
my_sp.vPosition);
};
// Add listener.
my_sp.addEventListener("scroll", scrollListener);
// Create listener object for completed loading.
var completeListener:Object = new Object();
completeListener.complete = function(evt_obj:Object) {
trace(evt_obj.target.contentPath + " has completed loading.");
};
// Add listener.
my_sp.addEventListener("complete", completeListener);
my_sp.contentPath = "http://www.helpexamples.com/flash/images/
image1.jpg";
The examples creates a scroll pane, sets its size, and loads an image to it using the
property. It also creates two listeners. The first one listens for a scroll event
contentPath
and displays the image's position as the user scrolls vertically or horizontally. The second
one listens for a complete event and displays a message in the Output panel that says the
image has completed loading.

Customizing the ScrollPane component

You can transform a ScrollPane component horizontally and vertically while authoring and at
runtime. While authoring, select the component on the Stage and use the Free Transform tool
or any of the Modify > Transform commands. At runtime, use the
UIObject.setSize()
1096
ScrollPane component
) or any applicable properties and methods of the ScrollPane class.
method (see
setSize()

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash 8

Table of Contents