Ok, gonna try to figure it out okay, I think it can be fixed with a simpel preloader, but lemme try, I will get back to you
As I understand you want to preload (or just load) an MP3 from an external location to the cache of the user and then play it in flash, right? And with it goes the "loading" text.
Quick question though, are you search that it needs to be loaded from an external location? Becuase if you import it inot the library its much easier, lemme know, in the mean time I'm trying to make the external preloader
Maybe I am missing the point, but would you not just create a function for onLoad eg:
loudspeaker = new Sound();
loudspeaker.onLoad = function(success) {
if (success) {
// Code to stop the loading MC
_root.loadclip.stop();
} else {
// Code for a failure
}
};
function getSound( URL ){
loudspeaker.loadSound(URL );
_root.loadclip.play();
}
Then in the button you just have:
on (press) {
getSound("http://www.mysite.com/track1.mp3",_root.soundMC);
}
Blaster, where does it output the prcentage to a loading bar or to text?
I really want to load the sound from a different directory in one server, couse all my sound i keep it in one single folder to keep everything verry organized.
Then you create a textbox and give it an instance name, eg. Tbox and you input the text that the variable "loaded" holds into that textfield.
Code:
Tbox.text=vartext
Now, try this out, create a textbox on the layer and name it Tbox, then span the the textbox over 3 frames. Create a new layer and make sure that this layer spannes over 3 frames to. On frame 2 create a keyframe and open the actions panel, put in this code:
Code:
vartext = _root.getBytesLoaded()/_root.getBytesTotal()*100;
Tbox.text = vartext;
if (vartext == 100) {
gotoAndPlay(3);
} else if (vartext<>100) {
gotoAndPlay(1);
}
What this code does is, it compares the see if vartext has reached 100(%) or not, if so he jumpes to the next scene, if not he replays frame one and so he updates the text field.
Then goto the next frame and open the actions panel again and input this code:
Code:
gotoAndStop("Scene 2", 1);
Now open the scenes palet and create a new scene, name it Scene 2 (it does it automaticly). On that timeline of the 2nd scene, just put something big, like a picture, something that is over 20kb, so you can see the loader working.
Make sure that Scene 1 (the preloader scene) it above scene 2, vary important, becuase flash must read scene 1 first. Then goto Control>Test Movie, then View>ShowStreming, and watch the magic happen
If you need any assistance, just yell!
Xeno.
And voila, you have a textbox that displays the percentage loaded. You an use the output of the formula in various ways to create a load bar with the width propertie or all kinds of other stuff.