PDA

View Full Version : progress bar loads from center


romeooros
03-08-2008, 04:23 PM
Hello,
I'm not too experienced with Flash and often follow tutorials for getting what I need done. I am creating a progress bar for .flv movies (loaded externally) and the bar depicts itself as loading from the center our versus left to right.
I've reviewed the code several times and can't find anything wrong with. Any advice?

below is the code:

var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);

theVideo.attachVideo(ns);

ns.play("http://futureperfekt.com/calstreetskater.flv");

playButton.onRelease = function() {
ns.pause();
}


pauseButton.onRelease = function() {
ns.pause();
}


var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;

function videoStatus() {
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
loader.loadbar._width = amountLoaded * 282;
}

filipeabreu
03-08-2008, 04:59 PM
Well, perhaps your loader.loadbar movieclip is centered, so when its width scales it will scale centered as well. Try to align the shape inside the loader.loadbar movieclip to left of the the registration point of the movieclip.

romeooros
03-08-2008, 06:28 PM
you're right. i finally figured it out. argh, amateur.