tanel96
September 12, 2004, 4:30pm
1
i’m getting deseprate by now… i’ve been trying to get my audio preloader to work for 7h straight, and no positive results… it should be simple:
// actions on main timeline frame 1
stop();
my_sound = new Sound();
my_sound.loadSound(“song.mp3”, false);
// actions of a movie clip named mc_preloader that is also on the main timeline frame 1
onClipEvent(load){
bytestotal = _root.my_sound.getBytesTotal();
}
onClipEvent(enterFrame){
bytesloaded = _root.my_sound.getBytesLoaded();
_root.loaded.text = bytesloaded;
}
// there is also a dynamic text box on the first frame in the main timeline with an instance name of “loaded”
And it doesnt show the bytes loaded… i’m about to kill myself… why isn’t it working ?
system
September 13, 2004, 5:18am
2
ok, try this, get rid of all those actions on the movie clip, erase your timeline actions too. replace your timeline actions with this :
mySound = new Sound(this);
mySound.loadSound("song.mp3")
loadBar._width = 0;
this.onEnterFrame = function() {
total = myMusic.getBytesTotal();
loaded = myMusic.getBytesLoaded();
percent = Math.round((loaded/total)*100);
loadText = percent+"%";
this.loadBar._width = percent;
if (loaded == total && total > 0) {
myMusic.start(0,1);
delete this.onEnterFrame;
}
};
make sure your preloader bar instance name is “loadBar” or it wont work.
system
September 13, 2004, 6:30am
3
i changed the code a little… but it still doesn’t work, shows 100% all the time.
mySound = new Sound(this);
mySound.loadSound("Song.mp3");
loadBar._width = 0;
this.onEnterFrame = function() {
total = mySound.getBytesTotal();
loaded = mySound.getBytesLoaded();
percent = Math.round((loaded/total)*100);
loadText = percent+"%";
_root.percentage.text = loadText;
this.loadBar._width = percent;
if (loaded == total && total>0) {
myMusic.start(0, 1);
delete this.onEnterFrame;
}
};
system
September 13, 2004, 8:10am
4
2 questions:
did you make sure you named your movieclip instance “loadBar” ?
do you have everything targeted correctly…like your loadBar movieclip?
of all thats correct then post your .fla and ill look at it. i had this exact same problem a while back.
system
September 13, 2004, 9:49am
5
thanks for helping me… the sound thing seems completely impossible… i’ll post the *.fla file in 20 minutes
system
September 13, 2004, 10:01am
6
here’s the file… it just shows 100% all the time
EDIT: ****… now it seems to be working… when i simulated the download progress through FlashMx on my hard drive it showed 100% all the time… but when i uploaded it to the internet it worked perfectly :-/