# Prograss bar with my mp3 player help

**URL:** <https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124>\
**Category:** Uncategorized\
**Created:** [February 5, 2004, 2:53pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124 "2004-02-05T14:53:24Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tattered](https://avatars.discourse-cdn.com/v4/letter/t/b9e5f3/32.png) [@Tattered](https://forum.kirupa.com/u/Tattered)\
**Post date:** [February 5, 2004, 2:53pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/1 "2004-02-05T14:53:24Z")

</div>

Not sure if i should post this here, or in another form but anyways i nned some help with a prograss bar. Im not sure how to do it, and i dont have a graphic made for it yet, but if some one can help or show me the way then please do. oh and here is my file [http://www.tatteredzdesign.climbingxtreme.com/Untitled-1.fla](http://www.tatteredzdesign.climbingxtreme.com/Untitled-1.fla)

---

<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:** [February 5, 2004, 3:02pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/2 "2004-02-05T15:02:55Z")

</div>

With any Sound object, you have the duration and position properties which are, as you would expect, the total time (in ms) of the sound and the position (also in ms) that it is currently playing, respectively. Now from this you could get a percentage of how much of the sound has been played through a ratio (position/duration)\*100%. Now you can apply this percentage to the scale of some graphic which you would use as a progress indicator. Simply set the \_xscale (or \_yscale if you wanna be funky) to that percentage in an onEnterFrame or something and as the song progresses, the bar grows in accordance.

The only problem with this is that in most cases, your bar will be centered meaning the bar would grow from the center instead of some side. To compensate, simply move the bar in the movieclip so that the registration point (the little crosshair) is at the point where you want it to grow from.

---

<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:** [February 5, 2004, 9:12pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/3 "2004-02-05T21:12:03Z")

</div>

what is your question exactly? do you need the code to create a preloader for your mp3s? if so i fought that battle a few weeks ago so id be glad to help, just not sure what you need.

---

<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:** [February 6, 2004, 1:37pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/4 "2004-02-06T13:37:32Z")

</div>

I want a bar like on win amp or somen else. I just want a load bar to show its loading and then when it plays I want a little bar to movie across the bar that was loaded. Do you understand what I am trying tto say now??

---

<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:** [February 6, 2004, 2:57pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/5 "2004-02-06T14:57:15Z")

</div>

> \*Originally posted by Tattered \*  
> \*\* when it plays I want a little bar to movie across the bar that was loaded. Do you understand what I am trying tto say now?? \*\*

not really…do you have an example of what you want?

---

<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:** [February 6, 2004, 4:46pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/6 "2004-02-06T16:46:27Z")

</div>

yes I do heres two actually  
[http://www.awamusic.com/index\_main.html](http://www.awamusic.com/index_main.html)  
www.davidusher.com

---

<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:** [February 6, 2004, 9:42pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/7 "2004-02-06T21:42:13Z")

</div>

well, as far as your mp3 preloader goes, the script i use goes like this:

myMusic = new Sound(this);  
myMusic.loadSound(“whatever.mp3”)  
loadBar.\_width = 0;  
this.onEnterFrame = function() {  
total = myMusic.getBytesTotal();  
loaded = myMusic.getBytesLoaded();  
percent = Math.round((loaded/total)\*100);  
loadText = percent+"%";  
this.loadBar.\_width = percent;  
if (loaded == total && total \> 0) {  
myMusic.start(0,1);  
delete this.onEnterFrame;  
}  
};  
thats what i used to load my mp3’s dynamically. it works pretty nice. as for your progress bar…it shouldn’t be too hard to figure out. im guessing you’ll just create an MC of a progress bar, give it an instance name like"progressBar", then use  
this.progressBar.\_width = (and im not quite sure what to put here)…

anyone else???  
ill see if i can figure it out

---

<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:** [February 6, 2004, 11:53pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/8 "2004-02-06T23:53:40Z")

</div>

Yhea that would be cool. If you get it, I would love an example of how to do it. Im just total lost with this prograss bar, and besides that I just woke up from a power nap.

---

<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:** [February 7, 2004, 1:24pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/9 "2004-02-07T13:24:09Z")

</div>

Something like this?

[SIZE=1]/\*link removed[/SIZE]

scotty(-:

---

<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:** [February 8, 2004, 3:06pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/10 "2004-02-08T15:06:17Z")

</div>

Yhea man thats just like the one I want.

---

<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:** [February 8, 2004, 3:45pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/11 "2004-02-08T15:45:19Z")

</div>

Just check the code to see what I’ve added and changed.

scotty(-:

---

<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:** [February 8, 2004, 4:05pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/12 "2004-02-08T16:05:05Z")

</div>

Thanks very much man. that helped a lot. not to put it up on-line and check it out!!!

---

<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:** [February 8, 2004, 4:43pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/13 "2004-02-08T16:43:25Z")

</div>

no problem:thumb:

---

<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:** [February 8, 2004, 10:56pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/14 "2004-02-08T22:56:26Z")

</div>

the load bar doesnt move across the sreen (the gradient), but the whit box works great. not really sure on the other part, but Im still looking at the code. 😃

-thanks

---

<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:** [February 9, 2004, 11:14am UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/15 "2004-02-09T11:14:32Z")

</div>

If you upload it to your server, it still doesn’t work?

scotty(-:

---

<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:** [February 9, 2004, 1:20pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/16 "2004-02-09T13:20:41Z")

</div>

yhea i uploaded it on the surver and it doest work. :S i dunno. heres the link for it to load

[here](http://www.tatteredzdesign.climbingxtreme.com/mp3player/tattered.html)

---

<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:** [February 9, 2004, 3:53pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/17 "2004-02-09T15:53:41Z")

</div>

I see, a little mistake at my side:)  
change  
[AS]per = Math.floor(Math.round(lo/to)\*100);[/AS]  
in  
[AS]per = Math.floor(Math.round((lo/to)\*100));[/AS]

Math.round (in the wrong code) will return 0 till more as 50% is loaded.

scotty(-:

---

<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:** [February 11, 2004, 4:47pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/18 "2004-02-11T16:47:17Z")

</div>

Ahhh thanks. I just changed it that time. I have one more question well 2 actually, then maybe Ill leave you alone hehee

What If I wanted to slide the position\_mc ahead in the song  
and  
"position\_mc should sort of grow, instead of staying the same size as that little rectangle".

Thats what my friend wants it to do, but I think it will look stupid but, I got to do it :S.

Well I was looking at tutorials to try and help me on that part but I seem to be going no place with em, so if you could help me once more that would be great, and thanks alot for you time in helping me.

---

<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:** [February 11, 2004, 5:04pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/19 "2004-02-11T17:04:19Z")

</div>

How much do you want it to grow and on what base?

scotty(-:

---

<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:** [February 11, 2004, 5:26pm UTC](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124/20 "2004-02-11T17:26:08Z")

</div>

I want it to grow as far as the first load bar is. I want it to grow on how far the song is, and if you drak it it will jump to some part of the song.

[Next page](https://forum.kirupa.com/t/prograss-bar-with-my-mp3-player-help/42124.md?page=2)
