A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: (flash MX 6.0) plz help me create sound on/off button

  1. #1
    Junior Member
    Join Date
    Aug 2006
    Posts
    2

    (flash MX 6.0) plz help me create sound on/off button

    hi all,
    very fresh in flash
    u know these buttons on websites that turn off sound and then back on once clicked again? i wana add one of these to my website which im building in flash MX 6.0. now i have a botton that says
    on (release) {stopAllSounds();

    }
    bu ti dont know what to add so that when i click it again the sounds comes back from mute.
    im hoping someone could plz help me it will be really appreciated.
    ps: whats the differense between event and a start music file?

    thanks a lot guys this is much appreciated.

  2. #2
    Member
    Join Date
    Jun 2006
    Location
    Leeds UK
    Posts
    84
    Hey mhafez100

    Here is a very good tutorial on sound objects with almost everything you need to know about sounds. Just a tip about your code try not to attach any AS to any object, good practice is to use frame action instead ( that means attaching code to a frame).

    http://www.flashkit.com/tutorials/Au...-824/index.php

    finally quick answer to your question, try this:

    PHP Code:
    //myBtn is the instance name of my button on the stage

    mySound = new Sound ();
    mySound.attachSound ("sound2");
    playing false;
    myBtn.onPress = function ()
    {
        if (
    playing == false)
        {
            
    mySound.start ("sound2");
            
    playing true;
        }
        else
        {
            
    mySound.stop ("sound2");
            
    playing false;
        }
    }; 

  3. #3
    Junior Member
    Join Date
    Aug 2006
    Posts
    2
    thanks a lot flashsmashed, this is highly appreciated. i'll give it a shot. the tutorial is great too!

    thanks again

  4. #4
    Member
    Join Date
    Jun 2006
    Location
    Leeds UK
    Posts
    84
    No problem

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