|  | Sound.getBytesLoaded proplems, help! |  | |
| | | DOC_PHILIPPE |  |
| Posted: Thu Jul 31, 2008 8:18 pm Post subject: Sound.getBytesLoaded proplems, help! |  |
I am trying to program a preloader for external MP3 files, the sound var is called MP3ToLoad so i figure my code should be as follows;
bytes_loaded = Math.round(_root.MP3ToPlay.getBytesLoaded()); bytes_total = Math.round(_root.Mp3ToPlay.getBytesTotal()); getPercent = bytes_loaded/bytes_total; loadText1 = Math.round(getPercent*100)+"%";
Though in the text box all i am getting is NaN% what might this problem be? source files online at LINK |
| |
| | | kglad |  |
| Posted: Thu Jul 31, 2008 8:56 pm Post subject: Re: Sound.getBytesLoaded proplems, help! |  |
| what's MP3ToLoad relationship to _root.MP3ToPlay |
| |
| | | DOC_PHILIPPE |  |
| Posted: Thu Jul 31, 2008 9:29 pm Post subject: Re: Sound.getBytesLoaded proplems, help! |  |
| sorry, it was a typo. The Sound var is called MP3ToPlay |
| |
| | | kglad |  |
| Posted: Thu Jul 31, 2008 10:09 pm Post subject: Re: Sound.getBytesLoaded proplems, help! |  |
| is you sound loading? if so, make sure _root.MP3ToPlay is the correct reference to your sound object by using a trace(_root.MP3ToPlay) |
| |
| | | DOC_PHILIPPE |  |
| Posted: Thu Jul 31, 2008 10:28 pm Post subject: Re: Sound.getBytesLoaded proplems, help! |  |
The sound is loading, and my var is declared as follows;
var MP3ToPlay:Sound = new Sound();
even when i attach the trace function _root.MP3ToPlay it still comes out as NaN% I'm stumped. |
| |
| | | kglad |  |
| Posted: Thu Jul 31, 2008 10:36 pm Post subject: Re: Sound.getBytesLoaded proplems, help! |  |
wha'ts trace(_root.MP3ToPlay) reveal?
and that code is in a loop, correct? |
| |
| | | DOC_PHILIPPE |  |
| Posted: Thu Jul 31, 2008 10:47 pm Post subject: Re: Sound.getBytesLoaded proplems, help! |  |
when i put in trace(_root.MP3ToPlay) the output stated [object Object] if by being in a loop you mean its ever present in the mc than yes it spans the entirety of the mc. (sorry about the low lingo knowledge I'm new at this) |
| |
| | | kglad |  |
| Posted: Fri Aug 01, 2008 2:39 am Post subject: Re: Sound.getBytesLoaded proplems, help! |  |
| that code needs to execute repeatedly. if you put trace(_root.MP3ToPlay) near that code, you should see [object Object] repeatedly. |
| |
| | | DOC_PHILIPPE |  |
| Posted: Fri Aug 01, 2008 1:35 pm Post subject: Re: Sound.getBytesLoaded proplems, help! |  |
Thanks! It's working, although for a split second before the numbers start loading it still reads NaN% do you have any idea why it's registering like that? |
| |
| | | kglad |  |
| Posted: Fri Aug 01, 2008 3:21 pm Post subject: Re: Sound.getBytesLoaded proplems, help! |  |
| bytes_total must be zero. |
| |
|
|