# Audio progress bar

**URL:** https://forum.kirupa.com/t/audio-progress-bar/26012
**Category:** Uncategorized
**Created:** [July 18, 2003, 3:11pm UTC](https://forum.kirupa.com/t/audio-progress-bar/26012 "2003-07-18T15:11:40Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![faceoff305](https://avatars.discourse-cdn.com/v4/letter/f/439d5e/32.png) [@faceoff305](https://forum.kirupa.com/u/faceoff305)
#### Post date: [July 18, 2003, 3:11pm UTC](https://forum.kirupa.com/t/audio-progress-bar/26012/1 "2003-07-18T15:11:40Z")

</div>

(mx) I’m trying to make an audio progress bar. I’d like any help that can be given to help me accomplish this. I’m loading the songs externally when it is selected. I just need a bar to represent the song being loaded. I’m loading the songs from .mp3s

track1= new Sound  
track1.loadSound(“morning.mp3”,false);

all= track1.getBytesTotal();

bytes\_loaded = Math.round(track1.getBytesLoaded());

getPercent = bytes\_loaded/all;

this.loadBar.\_width = getPercent_100;  
this.loadText = Math.round(getPercent_100)+"%";  
if(bytes\_loaded/all \>=.59){  
gotoAndPlay(3);  
}

the loadBar is the name of the progress bar\_mc…this is the script I’m using, but I’d scrap it for a script that works…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 18, 2003, 4:18pm UTC](https://forum.kirupa.com/t/audio-progress-bar/26012/2 "2003-07-18T16:18:27Z")

</div>

um…

1. Keep track, or better yet, find out how long each song is, preferably in milliseconds.

2. start a timer as soon as the song starts

3. divide (2)/(1) multiply it by 100, and you’ve got your progress percentage.

4. apply this to an object using their \_xscale/\_yscale (optional) bar. set (3) equal to the objects scale and you’ve got your progress bar.

This works very much the same as preloaders, which seem to be such a problem for everybody…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 18, 2003, 4:51pm UTC](https://forum.kirupa.com/t/audio-progress-bar/26012/3 "2003-07-18T16:51:04Z")

</div>

thanks for the advice, but how would I make the timer…the beginning is no problem.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 18, 2003, 5:03pm UTC](https://forum.kirupa.com/t/audio-progress-bar/26012/4 "2003-07-18T17:03:05Z")

</div>

I’m loading the songs from mp3s

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 18, 2003, 5:25pm UTC](https://forum.kirupa.com/t/audio-progress-bar/26012/5 "2003-07-18T17:25:13Z")

</div>

Flash 6 has the _SoundObj_.position and _SoundObj_.duration commands, so you could try those…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 18, 2003, 5:32pm UTC](https://forum.kirupa.com/t/audio-progress-bar/26012/6 "2003-07-18T17:32:04Z")

</div>

thanks pissant…I’ll check them out, I know you can divide them
