Sound volume / mouse controll
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Sound volume / mouse controll

  1. #1
    Senior Member
    Join Date
    Mar 2001
    Posts
    235
    I want to make a effect where the volume of a sound gets greater the closer the _xmouse gets an mc. Anybody with some ideas I use Flash MX so if it's easier there that's even better.

  2. #2
    Senior Member
    Join Date
    Jul 2002
    Posts
    461
    if you experiment with this code you can get it:

    onClipEvent (load) {
    mySound=new Sound()
    mySound.attachSound( "snd" )
    mySound.setVolume( 100 )
    mySound.start( 0, 999 )
    }

    onClipEvent (enterFrame) {
    gap= Math.abs ( _parent._xmouse - _x );
    mySound.setVolume(100-(gap/4));
    trace (mySound.getVolume());
    }

    eg try changing gap/4 to gap/5 or gap/3 or whatever until you like the result.
    [Edited by gaz_b on 09-09-2002 at 02:12 AM]

  3. #3
    Senior Member
    Join Date
    Mar 2001
    Posts
    235
    What If i had a scrolling background that moves when a character you controll gets close to the scene edges.

    I modified the code for the background and my character and it all works fine but when the distance between the two gets to high the volume gets louder. Is there anyway to set the volume to 0 when the distance is to high and can you make the distance longer?

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

Poll by Flashkit.com