A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Code for stopping and starting music

  1. #1
    Junior Member
    Join Date
    May 2010
    Posts
    23

    Code for stopping and starting music

    I'm making a platform game and I want to start a music track playing, and when I reach a certain keyframe (keyframe 2 for example) the music that was playing stops, and a different track plays.

    Ex: Mario is walking along with his happy little theme tune playing and all of the sudden Bowser comes by and the happy music shuts off and boss music starts playing.

    Thanks in advance.

  2. #2
    Junior Member
    Join Date
    Jun 2008
    Posts
    18
    var my_sound:Sound = new Sound();
    my_sound.attachSound("music1");
    my_sound.start();

    After certain key frame

    my_sound.stop();
    my_sound.attachSound("music2");
    my_sound.start();

  3. #3
    Junior Member
    Join Date
    May 2010
    Posts
    23
    Quote Originally Posted by brainstormingin View Post
    var my_sound:Sound = new Sound();
    my_sound.attachSound("music1");
    my_sound.start();

    After certain key frame

    my_sound.stop();
    my_sound.attachSound("music2");
    my_sound.start();
    Sounds good! I'll try it out and let you know. Thanks!

  4. #4
    Junior Member
    Join Date
    May 2010
    Posts
    23
    Worked like a charm!

Tags for this Thread

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