A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: preloading mp3 files

  1. #1
    I've put together a simple jukebox-type app using external MP3 files. I'm testing for sound.GetBytesLoaded() and sound.GetBytesTotal to preload the sounds. However, although the movie works, when I upload it, the IF statement for preloading always evaluates as true, even though the sounds are not actually loaded.

    I can't see anything wrong with the code (I've used a similar routine in the past), but was wondering if there are any issues to do with how the browser deals with the sounds, as they are not actually physically cached.

  2. #2
    President, save the
    New Zealand dollar foundation

    Join Date
    Jun 2000
    Posts
    1,743
    could you post your code?
    I'm thinking you have
    Code:
    if ( sound.getBytesLoaded = sound.getBytesTotal ) {}
    when you should have

    Code:
    if ( sound.getBytesLoaded == sound.getBytesTotal ) {}

  3. #3
    this is the code for the preloader, the main code is written on the main timeline as functions, this code is in a movie clip, so i can evaluate the preload. The next frame loops back to this one.

    Code:
    if (_root.s.getBytesLoaded() >= _root.s.getBytesTotal()) {
    	_root.playTrack();
    	this.gotoAndStop(1);
    } else {
    	_root.s.stop();
    	_root.status = "loading...";
    
    }
    this is the playTrack function which is on the main timeline:

    Code:
    function playTrack() {
    	s.start();
    	playing = true;
    	status = trackName+" playing";
    	}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center