A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: on-off music

  1. #1
    Junior Member
    Join Date
    Oct 2005
    Location
    malaysia
    Posts
    2

    on-off music

    i've put a bg music in my website. the music is looping over the whole website. i have 2 buttons to control the music (on/off). the problem is, the off button work very well with stopAllSounds but the on button does not work...i tried using play(); script but it seems to play the movie together with the music...please help me A.S.A.P ...


    thanks..

  2. #2

  3. #3
    Junior Member
    Join Date
    Oct 2005
    Location
    malaysia
    Posts
    2
    i can't open it...
    any other ways or sample...
    plzz...


    thanks in advance..

  4. #4
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi
    Here is a way...
    Have your sound in the library with a linkage name given to it(example:myLoop) and attach it via action script then control it with actions on the buttons....
    So in the first frame of movie....
    code:
    myLoop = new Sound();
    myLoop.attachSound("loop");
    myLoop.start(0, 999);//start the sound


    Then on your play button...
    code:
    on (press) {
    stopAllSounds();//prevents overlapping if sound already playing
    myLoop.start(0, 999);//start sound
    }


    Then on your stop button...
    code:
    on (press) {
    myLoop.stop();
    }


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