|
-
PLEASE FOR THE 1 MIL TIME, HELP.
I AM TRYING TO PRELOAD AN MP3. RECENTLY I USED THE FALLOWING CODE, by the WAY THEY WILL LOAD WHEN A BUTTEN IS PREASSED.
on (press) {
loadSound("http://www.mysite.com/track1.mp3",_root.soundMC);<---THE MP3
}
on (press) {
_root.loadclip.play();<---clip of flashing text
}
SO THEN HERE I WANT THE CLIP THAT FLASHES THE TEXT, THAT ACTUALLY SAYS LOADING TO STOP WHEN THE MP3 IS LOADED AND STARTS PLAYING.
I know its something
if (something something)
_root.loadclip.gotoAndPlay a frame where the text isnt visible so it wont say loading any more couse the song is loaded.
YOu understand? anybody? if not ask me.
Thanx ALOT
-
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.
Xeno.
-
THAT IS TRIGHT
YES, if you can explain it to me, thanx.
-
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 
Xeno.
-
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);
}
-
Nice 
I have this famous code that basicly outputs the percentage of the loaded movie:
Code:
_root.getBytesLoaded() / _root.getBytesTotal()
Is there any way to implement that into your code AlsoGaiusCoffey?
Xeno.
-
YEA...
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.
-
You can use the bytesloaded with the sound object by referencing it from your load movie. EG:
displayprogress = _root.loudspeaker.getBytesLoaded() / _root.loudspeaker.getBytesTotal()
Gaius
-
Ok, I'm gonna try that 
Freshguy, to display the amout of loaded percentage you must first assing a variable to the formula:
Code:
vartext=_root.getBytesLoaded() / _root.getBytesTotal()*100
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.
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|