Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Flash - ActionScript

Sound.getBytesLoaded proplems, help!

 
Jump to:  
 
DOC_PHILIPPE
PostPosted: 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
PostPosted: Thu Jul 31, 2008 8:56 pm    Post subject: Re: Sound.getBytesLoaded proplems, help!
       
what's MP3ToLoad relationship to _root.MP3ToPlay
 

 
DOC_PHILIPPE
PostPosted: 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
PostPosted: 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
PostPosted: 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
PostPosted: 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
PostPosted: 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
PostPosted: 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
PostPosted: 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
PostPosted: Fri Aug 01, 2008 3:21 pm    Post subject: Re: Sound.getBytesLoaded proplems, help!
       
bytes_total must be zero.
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

trwa pobierania linkow system wymiany linkow oczekiwanie na linki proces pobierania linkow pobieranie linkow