[MX2004] ScrollPane and preloader problem

Hello,

I’m working on this site where a ScrollPane is used to build a menu. It used to work fine until I added a very basic preloader to the movie (bytes_loaded/bytes_total style). Now, the first time the movie loads only a blank box appears in the upper left corner where the menu should be. After reload, everything works fine.

Here’s the link to the site, select any language and go to “Portfolio”

http://www.reyalfu.com/

This is the code to build the menu:

// << = PORTFOLIO MENUS START = >>

menuPort = new XML();
menuPort.ignoreWhite = true;
menuPort.onLoad = function() {
var rootNode = this.firstChild;
var allCats:Array = rootNode.childNodes;

import mx.containers.ScrollPane;

createClassObject(ScrollPane, “menu_sp”, getNextHighestDepth());
with (menu_sp) {
move(40, 44);
setSize(224,98);
hScrollPolicy = “off”;
vScrollPolicy = “on”;
contentPath = “menuWrap”;
}

// IN NESTED 1: SELECT CAT MENU

var i:Number = 0;
var obj:Object = new Object();
obj.interval = function() {
i++;

menu_sp.content.attachMovie("MenuCBtn", "CBtn"+i, i);
menu_sp.content["CBtn"+i]._y = menu_sp.content["CBtn" + (i-1)]._y + menu_sp.content["CBtn" + (i-1)]._height + 2;
menu_sp.content["CBtn"+i].createTextField("nameCats", getNextHighestDepth(), 10, 4, 150, 20);
// "menuCats" is locaded in the included textFormats.as file
menu_sp.content["CBtn"+i].nameCats.setNewTextFormat(menuCats);
menu_sp.content["CBtn"+i].nameCats.text = allCats[i-1].attributes.id;

menu_sp.invalidate();      // optional?:  menu_sp.redraw(true);

if (i&gt;allCats.length-1) {
    clearInterval(m);
}

var anyCBtn:Array = menu_sp.content["CBtn"+i]; 
var images:Array = allCats[i-1].childNodes;  
var thisCat:XMLNode = allCats[i-1];  

(…)

As I said, it works fine withouth the preloader. The problem with the blank box appears when I put this code in the frame 5 (and set movie to export classes in frame 5), with the basic preloader in the first 2 frames:

Frame 1:

bytes_loaded = Math.round(this.getBytesLoaded());
bytes_total = Math.round(this.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBar._width = getPercent100;
this.loadText = Math.round(getPercent
100)+"%";
if (bytes_loaded == bytes_total) {
this.gotoAndStop(5);
}

Frame 2:

gotoAndPlay(1);

Any ideas? :puzzled: