Показать сообщение отдельно
Старый 21.12.2006, 22:42
pkfun вне форума Посмотреть профиль Отправить личное сообщение для pkfun Посетить домашнюю страницу pkfun Найти все сообщения от pkfun
  № 4  
Ответить с цитированием
pkfun

Регистрация: Feb 2006
Сообщений: 580
Код:
var mn:MovieClip = this;
//
var mc_one:MovieClip = this.createEmptyMovieClip('one', this.getNextHighestDepth());
var mc_two:MovieClip = this.createEmptyMovieClip('two', this.getNextHighestDepth());
var mc_three:MovieClip = this.createEmptyMovieClip('three', this.getNextHighestDepth());
//
var my_sound_one:Sound = new Sound(mc_one);
var my_sound_two:Sound = new Sound(mc_two);
var my_sound_three:Sound = new Sound(mc_three);
//
my_sound_one.onLoad = function(success:Boolean) {
	if (success) {
		this.setVolume(90);
		this.start();
	}
	my_sound_two.loadSound('two.mp3', false);
	preloader(mc_two, my_sound_two);
};
//
my_sound_two.onLoad = function(success:Boolean) {
	if (success) {
		this.setVolume(90);
		this.start();
	}
	my_sound_three.loadSound('three.mp3', false);
	preloader(mc_three, my_sound_three);
};
//
my_sound_three.onLoad = function(success:Boolean) {
	if (success) {
		this.setVolume(90);
		this.start();
	}
};
//
//preloader
function preloader(mc_inst:MovieClip, snd_inst:Sound):Void {
	mc_inst.onEnterFrame = function():Void  {
		if (snd_inst.getBytesTotal() != underfined) {
			snd_inst.getBytesLoaded() == snd_inst.getBytesTotal() ? delete mc_inst.onEnterFrame : trace(Math.round((snd_inst.getBytesLoaded()/snd_inst.getBytesTotal())*100));
		}
	};
}
//
my_sound_one.loadSound('one.mp3', false);
preloader(mc_one, my_sound_one);
Проанализируйте этот пример последовательной загрузки трех музыкальных файлов.


Последний раз редактировалось pkfun; 21.12.2006 в 22:48.