Hi, how would you go about making a flash movie load sound when you press a button, but have a load bar increase to the % loaded and play while its loading (streaming)??
any ideas??
my code so far:
on a button:
on a movieclip on second frame (1st frame has a stop()
:
please help!
Regards,
Martin
Gaming Help And Info:
any ideas??
my code so far:
on a button:
Code:
on (press) {
my_sound = new Sound();
my_sound.loadSound("[URL unfurl="true"]http://localhost/Lemar.mp3",[/URL] true);
_root.mloader.gotoAndStop(2);
}
on a movieclip on second frame (1st frame has a stop()
Code:
this.onEnterFrame = function() {
//trace the percentage of the movie that has loaded
percent = (_root.my_sound.getBytesLoaded()/_root.my_sound.getBytesTotal())*100;
bys1 = _root.my_sound.getBytesLoaded();
byst1 = _root.my_sound.getBytesTotal();
bys = Math.floor(bys1/1024)+" kb /";
byst = Math.floor(byst1/1024)+" kb";
if (!isNan(percent)) {
// The following only concern the preloader's displays...
if (percent == 0) {
percent_display = "";
} else {
_root.grFlash.percent_display = Math.ceil(percent)+"%";
// LOADED.";
this.loadTxt.text = "Loading... "+Math.ceil(_root.my_sound.getBytesLoaded()/1024)+" / "+Math.ceil(_root.my_sound.getBytesTotal()/1024)+" kb";
trace("Loading... " + Math.ceil(_root.my_sound.getBytesLoaded()/1024)+" / "+Math.ceil(_root.my_sound.getBytesTotal()/1024)+" kb");
}
_root.grFlash.loadbar._visible = true;
this.loadBar._xscale = percent;
if (percent>1) {
this.reelmc._visible = true;
}
// End of preloader's displays...
//_root.my_sound.stop();
}
if (percent == 100) {
// this sends this preloader clip back to frame 1
// where it awaits the next call to it...
//this.gotoAndStop(1);
// this deletes this onEnterFrame event...
// so that the movie clip stops looping...
delete this.onEnterFrame;
//_root.my_sound.start();
this.gotoAndStop(1);
// end of preloader's displays handling...
}
};
stop();
please help!
Regards,
Martin
Gaming Help And Info: