Bleh. >.> Love the distinctions between _framesloaded/_framestotal and getBytesLoaded()/getBytesTotal
Anyhow, what the next version of the Projector's preloader will be like:
Frame 3 (because it really doesn't matter, and I like to have an empty frame between keyframes when I can..)
//NextKill stuff, disable the next button while preloading.
_root.NextKill.gotoAndStop(1); //deal with this better later.
_root.Next.setEnabled(false);
yipple = new Number(_root.Programs.getSelectedItem().data.attributes.PreLoad);
//check to see if PreLoad existed and is a valid value.
//If so, put it in a meaningful variable.
Percent = (yipple != 0 && yipple <= 1) ? yipple : 1;
Karol: It's my program, I'll use "yipple" for something that I use for less than a nanosecond if I damn well please. :p
Anyhow. Frame 5's code:
Yea. It's a blank keyframe. >.> These are important in preloaders, actually.
So, Frame 6, which does stuff:
if(_root.Projection.getBytesLoaded(); < (_root.Projection.getBytesTotal() * Percent) ||
_root.Projection._framesloaded < 2){ //use _framesloaded to ensure we don't
gotoAndPlay(5); //move before the movie's even started
} else { //to load.
_root.Next.setEnabled();
/*if previous button hit, the variable "pbh" in root.
|this means we have to go to the last animation in the program instead
\*of the first.*/
if(_root.pbh){
_root.Projection.gotoAndPlay(_root.LastAnimInPrev);
_root.pbh = false;
}else{
_root.Projection.prime();
}
this._visible = false;
stop();
}
[edit]Oh, yea. The preloader bar's code:
ComputedWidth = ((_root.Projection.getBytesLoaded())/(_root.Projection.getBytesTotal() * _parent.Percent)) * 470;
this._width = ComputedWidth > 470 ? 470 : ComputedWidth;