Mock progress bar - what is wrong with this code?

Basically I try to create something which simulates the uploading of a file as acurately as possible, that is the process takes longer with bigger files. In reality nothing is uploaded. But file name, size, loading bar and percentage is shown as usual. This code seems to work okay unless I chose very small files.

(You might want to know what this is for - it is art :slight_smile:

Here are the two functions that control the process:

function uploadCurrent():Void {[INDENT] chooseButton_mc._visible = false;
progressBar = makeProgressBar(0, progressBarY);
progressBarFrame = makeProgressBarFrame(0, 55);

fractionSize = progressBarLength/fileSize;

// 1/100s gives a smooth animation at a slower loop with less calculation than 1/1000s

setInterval (updateProgress, 10);


function updateProgress () {[INDENT] if(counter>=fileSize){[INDENT] display_txt.text = β€˜Thanks for uploading your file!’;
else{[INDENT] currentLength = currentLength + fractionSize;
progressBar._width = currentLength;
progressBarFrame._width = 504;
display_txt.text =’ - β€˜+Math.ceil((counter/fileSize)*100)+’%’;
counter = counter + 1;