I was wonder if there is any built-in support in Flash CS4/AS 3.0 for scrolling for basic Display Objects like Sprites and MovieClips?
So I am programatically constructing content inside a MovieClip by dynamically creating instances of Symbols, MovieClips and other native controls such as TextFields and then placing and adding these objects into the Parent MovieClip's DisplayList using addChild(). The height of the displayed data varies based on the source data (loaded from a server, etc).
I wanted to display all this data within a limited size (width, height), which necessitates scrolling when there is a lot of data to display. I tried using a ScrollPane and setting the MovieClip as its source (just like the example in the AS 3.0 documentation - sort of), but instead I get the following error when, presumably, the ScrollPane was being rendered:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
Cannot display source code at this location.
My code is something like the following:
var ListPane:MovieClip = new MovieClip();
// Add display elements to ListPane ...
// Create a scroll pane
var Pane:ScrollPane = new ScrollPane();
Pane.verticalPageScrollSize = PaneHeight;
// Assign the Sprite as the source for the scroll pane
Pane.source = ListPane;
I'd really like to avoid having to implement my own scrollableMovieClip class extension if at all possible, so any help and wisdom will be greatly appreciated!