A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: sound control on/off btns

  1. #1
    Junior Member
    Join Date
    Sep 2005
    Posts
    20

    sound control on/off btns

    on off btns control?

    --------------------------------------------------------------------------------

    Ok Have created this navbar swf file with sounds on all the 5 btns in rollover states on my web page. How can I put/create an on/off button that's a seperate file to this so visitors can control if they don't want to listen? Is this possible, and what would the code be?

  2. #2
    Senior Member
    Join Date
    Sep 2005
    Location
    Gothenburg, Sweden
    Posts
    357
    Yes its possible, wait and i get the code for you...
    /xzerox... Take a look at http://www.vmgcomputers.com/h75

  3. #3
    Senior Member
    Join Date
    Sep 2005
    Location
    Gothenburg, Sweden
    Posts
    357
    Put this script on your first frame:

    s = new Sound(this);
    s.attachSound("mySound");
    s.setVolume(100 );

    Use this action script on the button to turn sound of:

    on (release) {
    s.setVolume(0 );
    }

    And this to turn on again:

    on (release) {
    s.setVolume(100 );
    }

    If you wan't the music to fade in use this 10 codes in 10 frames that you want the music to fade in (you have du set the volume to 0 on the first frame if you wan't this effect to work, or else will it have 100% volume in the start den fade in):

    s.setVolume(10 );
    s.setVolume(20 );
    s.setVolume(30 );
    s.setVolume(40 );
    s.setVolume(50 );
    s.setVolume(60 );
    s.setVolume(70 );
    s.setVolume(80 );
    s.setVolume(90 );
    s.setVolume(100 );

    You can play with the script as you want an use s.setVolume(50 ); for 50% volume, you will understaind...

    For a noob to another :P:P
    /xzerox
    /xzerox... Take a look at http://www.vmgcomputers.com/h75

  4. #4
    Junior Member
    Join Date
    Sep 2005
    Posts
    20
    confused. Ok if I do have this navbar with actionscript rollover sounds (not music) each button different sounds-- stop all??? Will this work on seperate on/off btn file that's not part of this but on the same web page?

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