PDA

View Full Version : scroll pane not scrolling with loaded images


thesquirrel
10-17-2005, 05:06 PM
Hi,

I have a scroll pane on the stage, into which Im loading several images. The vScrollPolicy is set to 'on'.

However, although the images do load into the scroll pane, the scroll bar does not appear and the pane wont scroll.

Heres the code ...


buildMenu = function():Void {
var nDepth:Number = menuContent_mc.getNextHighestDepth();
if (nDepth < nImages) {
var image_mc = menuContent_mc.createEmptyMovieClip("image"+nDepth+"_mc", nDepth);
image_mc._y = menuContent_mc._height + 10;
loader_mcl.loadClip("assets/activity_board_img"+nDepth+".jpg", image_mc);
};
};

// set up scroll pane menu
images_sp.contentPath = "blank_mc";
var menuContent_mc:MovieClip = images_sp.content;

// set up loading listeners
var loadListener:Object = new Object();

loadListener.onLoadInit = function(target_mc:MovieClip):Void {
buildMenu();
};

var loader_mcl:MovieClipLoader = new MovieClipLoader();
loader_mcl.addListener(loadListener);

buildMenu();



Any ideas? It works if I add text fields to the empty movie clips, rather than load images into them. So it must be something to do with loading images.

Thanks in advance.

thesquirrel
10-18-2005, 03:32 PM
ok ... if i re-draw the scroll pane after all the images have downloaded, it works ...


buildMenu = function():Void {
var nDepth:Number = menuContent_mc.getNextHighestDepth();
if (nDepth < nImages) {
var image_mc = menuContent_mc.createEmptyMovieClip("image"+nDepth+"_mc", nDepth);
image_mc._y = menuContent_mc._height + 10;
loader_mcl.loadClip("assets/activity_board_img"+nDepth+".jpg", image_mc);
} else {
images_sp.invalidate();
}
};

// set up scroll pane menu
images_sp.contentPath = "blank_mc";
var menuContent_mc:MovieClip = images_sp.content;

// set up loading listeners
var loadListener:Object = new Object();

loadListener.onLoadInit = function(target_mc:MovieClip):Void {
buildMenu();
};

var loader_mcl:MovieClipLoader = new MovieClipLoader();
loader_mcl.addListener(loadListener);

buildMenu();