Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 1.0/2.0 (http://www.flasher.ru/forum/forumdisplay.php?f=93)
-   -   Проблема с регулятором звука. (http://www.flasher.ru/forum/showthread.php?t=90443)

sweetlove 11.01.2007 13:58

Проблема с регулятором звука.
 
Уважаемые Гуру.
Помогите пожалуйста блондинке.
Подскажите что нужно добавить в код, чтоб бегунок на регуляторе звука находился в положении уровня громкокости звука при загрузке , а не на нуле.
Код:

// //This button is both a movie clip and a button, because it
//needs to respond as a button and it also needs to slide.
//To do this, you need to have it as a button in the symbol
// library, then assign it as a movie clip instance in the
//properties box.
onClipEvent(load){
//myY is the position of the slider button
//the button must be positioned at the bottom
//of the slider to start
        myY=_y;
        //the top of the slider bar is top
        top=_y-_root.mySliderBar._height;
        //the bottom of the slider bar is bottom, and it
        //is set by the position of the button, which must
        //be placed at the bottom.
        bottom= _y;
        //right and left are the _x position of the button
        //(the middle of the button)
        right=_x;
        left=_x;
        //set the volume to off. thisSound is created in the
        //action script in frame one, and needs to be targeted
        //by using the word "_root" in front of it.
        _root.thisSound.setVolume(80);
}

//The following lines allow the button/movie clip to be
//dragged, but only up and down and only for the
//height of the slider. Left and right are set to the
//same value, so it cannot go left or right, only up and
//down.
on(press){
        startDrag("",false,left,top,right,bottom);
}
on(release){
        stopDrag();
        //the volume is a number between zero and 100 and
        //represents the difference between the bottom of
        //the slider and the current position of the button
        //times the ratio of the full volume (100) to the
        //height of the slider bar. This gives a value of
        //100 when the slider button is at the top of the
        //slider bar, and adjusts the volume correctly for
        //every position in between the top and the bottom.
       
        _root.thisSound.setVolume((myY-_y)*100/_root.mySliderBar._height);
        }

.

Чтоб было наглядней, Флешку можно увидеть здесь: http://kataliz.spb.ru/autonata.html

Заранее спасибо
;)

Kikasso 11.01.2007 15:13

Я не гуру но посоветую:
Код:

<ползунок>._y = _root.thisSound.getVolume()*_root.mySliderBar._height/100
И кстати тема скоро переедет.. из-за on() и onClipEvent()

исправлено: конечно thisSound, а не mySound

toFlash 11.01.2007 15:32

Код:

//set the volume to off. thisSound is created in the
//action script in frame one, and needs to be targeted
//by using the word "_root" in front of it.
_root.thisSound.setVolume(80);
_y = _root.thisSound.getVolume()*_root.mySliderBar._height/100


sweetlove 11.01.2007 19:14

Огромное спасибо!!
А не подскажите, что надо использовать мимо on() и onClipEvent()?

Kikasso 11.01.2007 19:30

примерно так:
Код:

клип.onLoad = function(){...}
кнопка.onRelease = function(){...}

это пишется на таймлайне, в кадре.
посмотри в хелпе про события кнопок и клипов, там с примерчиками.


Часовой пояс GMT +4, время: 09:37.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.