Where should my variable go?!

Hey y’all,

I have a problem with a preloader which I think is down to where my variables are being defined but I’ve tried everything to no avail. When I trace out the percentage loaded of an external file, it says 100% for the first few passes, then starts from 0 and counts up as it should. This has no impact visually but is ballsing up my preloader, which is based on one of Scotty’s from another post … can anyone see what the issue is?? Excuse my code :frowning:

Many thanks…

content.loadMovie (“backs/4.jpg”);

time = 0;
anchors = [[0,0],[100,0],[100,100],[0,100]]; // square

getbyte = _root.content.getBytesLoaded();
totalbyte = _root.content.getBytesTotal();
createEmptyMovieClip(‘square’,0);
square.onEnterFrame = function(){

xtime = Math.round((100/_root.content.getBytesTotal()) * _root.content.getBytesLoaded());
time= xtime / 100;
trace (time);
if (getbyte == totalbyte){
    delete this.onEnterFrame;
    square.tween ("_alpha", 0, 1, linear);
}

// variables
var seg = Math.min(Math.floor(time*anchors.length), anchors.length-1);
var nextseg = (seg < anchors.length-1) ? seg + 1 : 0;
var segtime = (time-seg/anchors.length)*anchors.length;

// draw
this.clear();
this.lineStyle( 5, 0xFF0000, 100 );
for (var i=0; i<=seg; i++) {
    if (!i) this.moveTo.apply(this, anchors[0]);
    else this.lineTo.apply(this, anchors*);
}
this.lineTo(
    anchors[seg][0] + (anchors[nextseg][0]-anchors[seg][0])*segtime,
    anchors[seg][1] + (anchors[nextseg][1]-anchors[seg][1])*segtime
);

};