3 Replies Latest reply on Jan 13, 2011 8:01 AM by yalp.com.br

Calculating progress bar size

Hi guys,

I'm having some problems trying to calculate the size of a progress bar.

Here is the thing I have a movie with X scenes and I want the progress  bar to fill up according to the porcentage of my timeline that has  passed.

here is the code I'm using

var parcialSeek
var completeSeek

function tamanhoBarra(e:Event):void{
completeSeek = vid_mc.totalFrames // vid_mc is the movie clip that loads my external SWF
parcialSeek = vid_mc.currentFrame / vid_mc.totalFrames
seek_mc.seekBar_mc.scaleX = parcialSeek
}

with this code every new scene the bar starts again and since I don't  have exacts 100 frames on my movie the bar size dosen't match?

• 1. Re: Calculating progress bar size

var previousframes:uint=0;
var sceneframe:uint=0;

function tamanhoBarra(e:Event):void{
completeSeek = vid_mc.totalFrames // vid_mc is the movie clip that loads my external SWF
if(vid_mc.currentFrame==1){
previousframes += sceneframe;
}
parcialSeek = (previousframes+sceneframe)/vid_mc.totalFrames
seek_mc.seekBar_mc.scaleX = parcialSeek
sceneframe=vid_mc.currentFrame;
}

• 2. Re: Calculating progress bar size

the code works, the only problem is when I skip a scene the bar goes to 0 and not the porcentage of the totalFrames viewed, and when the scenes change the bar clicks (it fills up and comes back to position, understand?)

I have a total amount of frames on my SWF I need the bar to show the porcentage of the movie that is been seen.

best regards!

• 3. Re: Calculating progress bar size

PLS HELP!