Sound getBytesLoaded [AS 2] 
Klasa: Sound
Kompatybilność: ActionScript 1.0, Flash 5+
Zwraca liczbę załadowanych bajtów (źródłowych) dla określonego obiektu Sound.
Możesz porównać tą wartość z wartością zwróconą przez Sound.getBytesTotal(), aby określić procentowy postęp załadowanego dźwięku.
Listing
this.createTextField("wiadomosc_txt", this.getNextHighestDepth(), 10,10,300,22)
this.createTextField("status_txt", this.getNextHighestDepth(), 10, 50, 300, 40);
status_txt.autoSize = true;
status_txt.multiline = true;
status_txt.border = false;
var moj_sound:Sound = new Sound();
moj_sound.onLoad = function(success:Boolean) {
if (success) {
this.start();
wiadomosc_txt.text = "Wczytano";
}
};
moj_sound.onSoundComplete = function() {
wiadomosc_txt.text = "Wyczyszczone powatarzanie się";
clearInterval(moj_interval);
};
moj_sound.loadSound("muzyka2.mp3", true);
var moj_interval:Number;
moj_interval = setInterval(checkProgress, 100, moj_sound);
function checkProgress(the_sound:Sound):Void {
var pct:Number = Math.round(the_sound.getBytesLoaded()/the_sound.getBytesTotal()*100);
var pos:Number = Math.round(the_sound.position/the_sound.duration*100);
status_txt.text = the_sound.getBytesLoaded()+" z "+the_sound.getBytesTotal()+" bajtów ("+pct+"%)"+newline;
status_txt.text += the_sound.position+" z "+the_sound.duration+" millisekund("+pos+"%)"+newline;
}
 
        	this.createTextField("status_txt", this.getNextHighestDepth(), 10, 50, 300, 40);
status_txt.autoSize = true;
status_txt.multiline = true;
status_txt.border = false;
var moj_sound:Sound = new Sound();
moj_sound.onLoad = function(success:Boolean) {
if (success) {
this.start();
wiadomosc_txt.text = "Wczytano";
}
};
moj_sound.onSoundComplete = function() {
wiadomosc_txt.text = "Wyczyszczone powatarzanie się";
clearInterval(moj_interval);
};
moj_sound.loadSound("muzyka2.mp3", true);
var moj_interval:Number;
moj_interval = setInterval(checkProgress, 100, moj_sound);
function checkProgress(the_sound:Sound):Void {
var pct:Number = Math.round(the_sound.getBytesLoaded()/the_sound.getBytesTotal()*100);
var pos:Number = Math.round(the_sound.position/the_sound.duration*100);
status_txt.text = the_sound.getBytesLoaded()+" z "+the_sound.getBytesTotal()+" bajtów ("+pct+"%)"+newline;
status_txt.text += the_sound.position+" z "+the_sound.duration+" millisekund("+pos+"%)"+newline;
}
Dodano przez: divix  
Ranga: Administrator serwisu Punktów: 0
Ranga: Administrator serwisu Punktów: 0
Komentarze użytkowników
:: Losowe artykuły 

:: Wymiana linków 
    
	Modowe inspiracje |
        Android Gry i Aplikacje |
        ZaplanujTransport.pl: Przeprowadzki, transport, aukcje |
        Logo dla firmy |
        Change Tires - Car Weather Forecast Reminder |
        Laminas: MVC Framework for PHP |
        IT Books Reviews and Programming: JS, JAVA, PHP, ANDROID, CSS | 
        Katalog roślin |
        Programming articles: JAVA, PHP, C++, Python, JavaScript |
        Kancelaria Adwokacka Łukasz Huszno
        
    

 
  
				

 
                             
 


 
                        
 
		 
	