[HELP] preloader for dynamically loading img

Hi Flash Guru’s,

I am having a lot of trouble to get a preloader working for this code.

Short Desc: i have a listbox which gets the data from XML page. once i click on any on of the lable in the listbox, a image loads in a movieclip.

I am trying to add a preloader to the moviclip. the code below is what iam using:

 _root.procent = Math.round((_root.scrollpane_sp.getBytesLoaded()/_root.scrollpane_sp.getBytesTotal())*100);

The loader movieclip has the onClipevent code.

Here is the full code:

[AS]onItemSelect = function () {
var imgSrc = listBox.getSelectedItem().data
scrollpane_sp.loadScrollContent(imgSrc,“onScrollContentLoaded”,this)
_root.procent = Math.round((_root.scrollpane_sp.getBytesLoaded()/_root.scrollpane_sp.getBytesTotal())*100);
//display loading screen here
}

onScrollContentLoaded = function () {
trace(“content finished loading”)
//hide loading screen here
}

listBox.setChangeHandler(“onItemSelect”,this)[/AS]