Just prepload 50% then play?

Hi all.
I want just file preload 50% and then it play, 50% remain it will load while playing. But I can’t do it, here is my code:

bytes_loaded = Math.round(_root.getBytesLoaded());
bytes_total = Math.round(_root.getBytesTotal());
getPercent = bytes_loaded/bytes_total;

bytes_total = bytes_total/2; // it will loop because it turn back to play untill full load
trace(bytes_total);

_root.loadBar._width = getPercent*100;
_root.loadText = Math.round(getPercent*100)+"%";
if (bytes_loaded == bytes_total ) {
	_root.gotoAndPlay(3);
}

Suppose that my file is 130 kb, and I write my If statement:


if (bytes_loaded == 70000) {
	_root.gotoAndPlay(3);
}

but it doesn’t work too.
what I have to do ?
thanks

frame 1

stop();
PercentLoaded = getBytesLoaded() / getBytesTotal() * 100;
if (PercentLoaded = 50) {
gotoAndStop("loaded");
}

frame 2

gotoAndPlay(1);

It should say:

if(PercentLoaded >= 50), Skribble. Just to be safe, because it may not equal exactly 50, and even if you knew it would, you’d have if(PercentLoaded == 50)

ah, I see what Dangerskew mean, because the movie can load not exactly 50% (maby 50, …1%) so we need to use >=

thanks

Hey scribble, that would’ve been a difference between an A and a B on my comp sci exam. Please watch for the newbies out there that see your code and pull their hair out when it doesnt work. It’s happened to me before and I didnt like the feeling!!!

<-- that was me being too serious. =)