Показать сообщение отдельно
Старый 25.03.2010, 17:13
in4core вне форума Посмотреть профиль Отправить личное сообщение для in4core Найти все сообщения от in4core
  № 9  
Ответить с цитированием
in4core
 
Аватар для in4core

Регистрация: Mar 2009
Сообщений: 4,219
Записей в блоге: 14
Вот выдерка из моего класса. Посмотри внимательнее разберись что зачем. Там полностью организована прокрутка ( как со 100% так и до 100% , то что ты хотел).
Код AS1/AS2:
function setMusicActive(c, f) {
 
 
		sound = new Sound(c);
		sound.setVolume(100);
		sound.onSoundComplete = mx.utils.Delegate.create(this, Complete_control);
		sound.loadSound(soundArray[f],true);
		sound.onLoad = mx.utils.Delegate.create(this, Complete_control);
		sound.start();
		CLP[0]._parent.o.drag.enabled = false; // клип драггера ползунка
		CLP[0]._parent.stop_btn.onRelease = mx.utils.Delegate.create(this, Stop_control); // кнопка остановки трека
		CLP[0]._parent.play_btn.onRelease = mx.utils.Delegate.create(this, Play_control); // кнопка проигрывания
		CLP[0]._parent.pause_btn.onRelease = mx.utils.Delegate.create(this, Pause_control); // кнопка паузы
		CLP[0]._parent.v.drag.onPress = mx.utils.Delegate.create(this, DRAGGER); // далее идут  события для драгов
		CLP[0]._parent.o.drag.onPress = mx.utils.Delegate.create(this, DRAG2);
		CLP[0]._parent.o.drag.onRelease = mx.utils.Delegate.create(this, SDRAGGER2);
		CLP[0]._parent.o.drag.onReleaseOutside = mx.utils.Delegate.create(this, SDRAGGER2);
		CLP[0]._parent.v.drag.onRelease = mx.utils.Delegate.create(this, SDRAGGER);
		CLP[0]._parent.v.drag.onReleaseOutside = mx.utils.Delegate.create(this, SDRAGGER);
		clearInterval(_int2);
		clearInterval(SU);
		SU = setInterval(this, "checkProgress", 200);
		update();
	}
	function Play_control() {
		if (paused) {
			sound.start(currentPosition);
			paused = false;
		}
	}
	function Stop_control() {
		sound.stop();
		currentPosition = 0;
		paused = true;
	}
	function Pause_control() {
		if (!paused) {
			currentPosition = sound.position/1000;
			sound.stop();
			paused = true;
		} else {
			if (currentPosition>0) {
				sound.start(currentPosition);
				paused = false;
			}
		}
	}
 
	function Complete_control(success) {
		clearInterval(inn);
		if (success) {
			inn = setInterval(this, "UP", 20);
			CLP[0]._parent.o.drag.enabled = true;
		}
	}
	function DRAGGER() {
		clearInterval(_int2);
		CLP[0]._parent.v.drag.startDrag(false,-50,0,50,0);
		_int2 = setInterval(this, "update", 1);
	}
	function SDRAGGER() {
		CLP[0]._parent.v.drag.stopDrag();
		clearInterval(_int2);
	}
	function update() {
		var vol = CLP[0]._parent.v.drag._x+50;
		sound.setVolume(vol);
	}
	function DRAG2() {
		clearInterval(inn);
		clearInterval(_int2);
		CLP[0]._parent.o.drag.startDrag(false,0,0,100,0);
		_int2 = setInterval(this, "update2", 200);
	}
	function update2() {
		sound.start((Math.floor(sound.duration/1000)*CLP[0]._parent.o.drag._x)/100);
		clearInterval(_int2);
	}
	function SDRAGGER2() {
		CLP[0]._parent.o.drag.stopDrag();
		inn = setInterval(this, "UP", 20);
	}
	function UP() {
		CLP[0]._parent.o.drag._x = Math.floor(sound.position/sound.duration*100);
	}
	function checkProgress() {
		var Loaded = Math.round(sound.getBytesLoaded());
		var Total = Math.round(sound.getBytesTotal());
		var pct = Math.floor((Loaded/Total)*100);
		if (Loaded/Total != 1) {
			LIST_ITEM._parent["LIST_ITEM"+CI].progress._visible = true;
			LIST_ITEM._parent["LIST_ITEM"+CI].progress.gotoAndStop(pct);
		} else {
			clearInterval(SU);
			LIST_ITEM._parent["LIST_ITEM"+CI].progress._visible = false;
		}
	}
	function UnFocusCicled() {
		for (var a = 0; a<ar.length; a++) {
			LIST_ITEM._parent["LIST_ITEM"+a].progress.gotoAndStop(1);
		}
	}
	function DELETE() {
		delete sound;
	}
П.с. 1 - обрати внимане на функции UP и update2 . Честно щас не помню какие именно функции для ползунка громкости , а какие для прокрутки. но думаю разберешься
П.с. 2 много лишнего тут. обращай внимание только на механику. все удалить лишнее просто нет времени щас. удачи


Последний раз редактировалось in4core; 25.03.2010 в 17:15.