Problem with preloader for dynamically loaded jpegs

I use this code to display the progress of the jpeg im loading dynamically into my empty movieclip, bildholder.

bytes_loaded = Math.round(bildholder.getBytesLoaded());
bytes_total = Math.round(bildholder.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
loadpic = “_loading_product “+Math.round(getPercent*100)+” % loaded”;
if (bytes_loaded >= bytes_total) {
gotoAndPlay(“done”);
}

The problem is that I cant get the line:
bytes_total = Math.round(bildholder.getBytesTotal());

to work. It seems that Flash have a problem getting the TotalBytes for a dynamically jpeg.

When i set bytes_loaded to a fix number, say 5000, then the preloader works but not wgen I use the command .getBytesTotal()

Can anyone tell me why or how I can solve this problem.

any one please :b:

loadPic = function (picture) {
	bildholder.loadMovie(picture);
	preload();
};
preload = function () {
	this.createEmptyMovieClip("temp", 1000);
	temp.onEnterFrame = function() {
		var t = bildholder.getBytesTotal(), l = bildholder.getBytesLoaded();
		if (t && !isNaN(t)) {
			var percent = Math.round(l*100/t);
			if (l == t) {
				myTextField.text = "Done Loading";
				this.removeMovieClip();
			} else {
				myTextField.text = percent+" %";
			}
		}
	};
};
myButton.onPress = function() {
	loadPic("picture.jpg");
};

try including some _root or _parent bits because when you load the movie, you have to make sure the loaded movie is talking to itself, not the root timeline of the main movie.