Skip to main content
Known Participant
October 17, 2014
Question

Progress Bar Issue Actionscript 3 Adobe Air Program

  • October 17, 2014
  • 1 reply
  • 387 views

I'm currently having an issue where when I download a file from the internet, I update the source for a ProgressBar that I've created, and I set the ProgressBar to event mode, and as the file is downloading, the progressbar's value increments as normal. When I re-download the same file (source has not changed), the value of the ProgressBar is no longer accurate or producing the same value as before. Basically, the ProgressBar works correctly only 1 time when I launch my application. Is there a proper way to reset/update the ProgressBar after each download?

I've tried everything I can think of.

This topic has been closed for replies.

1 reply

October 17, 2014

Have you tried creating a custom progress bar to see if it is a component issue? Without knowing some of your code, I can only make guesses, but it could also be a caching issue. Have you tried to have it download a different file after downloading the first one with the progress bar acting as expected?

rs14smithAuthor
Known Participant
October 17, 2014

Right if I had to paste the code it would take several pages lol. I haven't tried using a custom progress bar, but I may look into that. The main feature I used from the Progress bar was the ability to see how many "bytes" had been downloaded and I presented that to the user. I'm using a combination of urlStream/fileStream to download the file. And the source of the ProgressBar Component is linked to an instance called download which handles all the downloading of files. So I use the progress Event to monitor when a download is taking place, and at the same time calculate how many bytes have been downloaded. This is probably not the best way to do it, but currently the only way I know how with my limited actionscript 3 knowledge.

I have confirmed at least my download class/package is downloading the full file each time even though my Progress bar only works 1 time, so it could be some of the things you pointed out that is causing it.

October 17, 2014

In case you didnt know, the ProgressEvent has two properties to deal with the main thing you liked about the ProgressBar, bytesLoaded and bytesTotal. So in your ProgressEvent function, you could update a TextField to tell the use those values using:

textfield.text = e.bytesLoaded + " / " + e.bytesTotal

The above example assumes your ProgressEvent function event parameter is labeled as "e" in: function onProgress(e:ProgressEvent):void {}

I haven't used any of the components since my AS2 days from long ago, so if any of what I listed above made no sense, let me know and I will try to reword it for you in your specific case.