Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help please with this mp3 preloader. Please, please.

Status
Not open for further replies.

webkaz

Technical User
Aug 6, 2006
4
US
I got this preloader online (O'riely safari) from the book ActionScript Cookbook.

I need to preload an mp3.

I feel that I am really close but I have done all that I can, trust me. I can manipulate actionscript but by no means could I write it. So...

Here are the files online:
They are preload-music2.fla, .swf and .html and they call Sound.as and MovieClip.as Don't ask me why preloading an mp3 with a progress bar component is so complicated but it seems to be (to me). In fact if anyone has a better flash preloader for an mp3 please send it my way. I like the way the progress bar component looks so if we can use that I would be a happy, happy, camper.

Oh and I am prying right now that one of you experts are online toinght... or even right now, because I need it by the morning. I know, I know, a tall order. That is why I am praying.

Thanks in advance to all the Flash ActionScript angels out there.

Webkaz
service@webkaz.com
 
I have seen this one and did not go with it because it is loading the mp3 with a button and I need it to load automaticaly by going to the page.

And at this point don't have the time to start over. I think I am really close with the present loader. Please tell me if I am wrong. ... anyone.

I could also handle a .fla that is ready to use. Just plug in the name of my mp3 and generate the swf. That would be just fine also.

Thanks agian, in advance.

Willie
 
Code:
mySound = new Sound();
mySound.loadSound("peter_kater.mp3", false);

mySound.onSoundComplete = function(){
    //If needed...
        //mySound.start(0,1);
};

// Create a listener object event function. The progress bar is an object so it needs an object function to work
myProgressBarListener = new Object();

// When the progress bar is complete and has preloaded this movie, the listener will call and run this code below:
myProgressBarListener = function (eventObject) {
    // Hide the progress bar now as we don’t need it any more
    pBar._visible = false;
    mySound.start(0,1);
};

// Declares a listener that detects when the progress component has loaded the movie and is complete. Then calls the function above: myProgressBarListener
pBar.addEventListener("complete", myProgressBarListener);

// We are now setting the progress bar component variables
// Set up the progress bar component to polled when loading the movie. In this case it has to be set to polled to work
pBar.mode = "polled";

// Set the location to load as this movie.
pBar.source = "_root.mySound";

// Set the conversion to 1. This basically means the component divides the current and total values loaded and to be loaded. Then it floors them (works out the difference between them) and displays the converted value in the label property
pBar.conversion = "1";

// Set the label to display the word 'loading' followed by the percentage value loaded so far
pBar.label = "LOADING %3%%";

// The direction the progress bar moves when loading
pBar.direction = "right";

// The location of the label that displays the percentage loaded so far
pBar.labelPlacement = "bottom";

// Stops the Movie at the current frame until the Movie has been preloaded
stop();

Regards. Web Hosting - Web Design
03/13/05 -> OLDNEWBIE VS FLASHKIT
 
You make it sound so easy.

You did it. This code works like a charm. Thanks Oldie or Newbie or which ever you are today.

Thanks for pulling through.

Here is the finished product. Once you get to the landing page. Just click the big picture of the dogs cramed in the cages.


Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top