![]() |
|
||||||||||
|
|||||
|
Регистрация: May 2010
Сообщений: 2
|
Уважаемые знатоки!
Помогите с интеграцией ручкой уровня громкости. И так: Делаю радио плеер вот по этому уроку Все работает, но я хотел бы чтобы управление громкостью было более удобным! Нашел подходящую ручку в совершенно другом проекте. Скопировал ее оттуда, но уперся в то, что не хватает знаний чтобы ее заставить трудиться с громкость. Подскажите как реализовать сие чудо? Исходник вложен. Очень на вас надеюсь. ![]() |
|
|||||
|
А в чем дело? - чистая математика. Крутить ручку надо в каких-то пределах. Скажем, [-160, 160] или [0, 2PI - PI/4], если работаем в радианах. Промежуток поворота смотрите сами, какой делать. Далее вычисляем процент громкости примерно так: текущийУгол / (максимальныйУголПоворота / 100)) / 100. И все, soundTransform в руки и вперед.
__________________
тут я |
|
|||||
|
Регистрация: May 2010
Сообщений: 2
|
КорДум, большое спасибо за проявленное внимание к моей проблеме.
![]() Я, честно признаться, не очень в AS... Мог бы кто-нибудь помочь примером или более подробно описать как это реализовать..? Может кто сможет примерно набросать код который бы мне помог? У меня в самой кнопке код такой: #initclip /* * Knob class. Extends MovieClip * Version: 1.0.0 * Desc: A simple rotary knob for choosing values */ // //========================================== // Create namespace in which to store classe //========================================== if (_global.com == undefined) { _global.com = new Object(); } if (_global.com.bit101 == undefined) { _global.com.bit101 = new Object(); } com.bit101.Knob = function() { this.setSens(this.cp_sens); this.min = this.cp_min; this.max = this.cp_max; this.range = this.max - this.min; this.orient = this.cp_orient; this.setValue(this.cp_start); } com.bit101.Knob.prototype = new MovieClip(); Object.registerClass("knob", com.bit101.Knob); com.bit101.Knob.prototype.onPress = press; com.bit101.Knob.prototype.onRelease = release; com.bit101.Knob.prototype.onReleaseOutside = release; com.bit101.Knob.prototype.setValue = setValue; com.bit101.Knob.prototype.getValue = getValue; com.bit101.Knob.prototype.update = update; com.bit101.Knob.prototype.setSens = setSens; com.bit101.Knob.prototype.setOrientation=setOrientation; // function press() { this.onMouseMove = rotate; this.downX = this._parent._xmouse; this.downY = this._parent._ymouse; this.downRot = this.pointer_mc._rotation; if (this.downRot < 0) { this.downRot += 360; } } function release() { delete this.onMouseMove; } function rotate() { if (this.orient == "horizontal") { var dist = this._parent._xmouse - this.downX; } else { var dist = this.downY - this._parent._ymouse; } this.rot = this.downRot + this.sens * dist; if (this.rot < 0) { this.rot = 0; } if (this.rot > 300) { this.rot = 300; } this.pointer_mc._rotation = this.rot; this.update(); updateAfterEvent(); } function setValue(amount) { if (amount > this.max && amount > this.min) { amount = Math.max(this.max, this.min); } if (amount < this.max && amount < this.min) { amount = Math.min(this.max, this.min); } this.value = amount; this.pointer_mc._rotation = (this.value - this.min) / this.range * 300; this.update(); } function getValue() { return this.value; } function update() { var tempRotValue = this.pointer_mc._rotation; if (tempRotValue < 0) { tempRotValue += 360; } this.value = tempRotValue / 300 * this.range + this.min; this.onChanged(); this.updateAfterEvent(); } function setSens(sens) { this.sens = sens; } function setOrientation(orient) { this.orient=orient; } #endinitclip function rotate() { if (this.orient == "horizontal") { var dist = this._parent._xmouse - this.downX; } else { var dist = this.downY - this._parent._ymouse; } this.rot = this.downRot + this.sens * dist; if (this.rot < 0) { this.rot = 0; } if (this.rot > 300) { this.rot = 300; } this.pointer_mc._rotation = this.rot; this.update(); updateAfterEvent(); } ![]() |
![]() |
![]() |
Часовой пояс GMT +4, время: 03:37. |
|
|
« Предыдущая тема | Следующая тема » |
| Теги |
| громкость , ручка |
|
|