A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: controlling timeline sound with sound object

  1. #1
    Junior Member
    Join Date
    Jun 2008
    Posts
    9

    controlling timeline sound with sound object

    I want to add sound controls on my presentation like this one http://www.kirupa.com/developer/mx/volume_slider.htm

    I only add
    Code:
    allSound=new Sound();
    allSound.setVolume(0);
    to controll all sounds on the timeline, not only a specific file, but it causes stop/play button doesn't work correctly.
    When I click on 'stop' the 'play' button and the slide never work again

    please tell me what I do wrong?

  2. #2
    Junior Member
    Join Date
    Jun 2008
    Posts
    9
    Now that I have more timeline sound I found this stop/start sound don't work for me. Now that I have the following main code
    Code:
    onClipEvent (load) {
    	allSound=new Sound();
    	allSound.setVolume(0);
    	_root.volume = 70;
    }
    onClipEvent (enterFrame) {
    	allSound.setVolume(_root.volume);
    }
    and code for the slider
    Code:
    this.ratio = 0;
    dragger.onPress = function() {
    this.startDrag(true, 0, 0, line._width, 0);
        this.onEnterFrame = function() {
            ratio = Math.round(this._x*100/line._width);
           _root.volume = ratio;
        };
     };
    dragger.onRelease = dragger.onreleaseOutside=stopDrag;
    I decided to set stop/play buttons to controll the volume like this
    Code:
    on (release) {
    	_root.mySlider.dragger._x = 0;
    	gotoAndStop(2);
    }
    for stop
    and respectively
    Code:
    on (release) {
    	_root.mySlider.dragger._x = 50;
    	gotoAndStop(1);
    }
    for play.

    Now it works just fine, except one problem:
    When the movie loads, you have to click on the slider first, to make the buttons work.

    Please help on this, I'm really a newbie on this, and I'm not sure what should I do now!?!

    10x

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center