A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Need sound help urgently

  1. #1
    Registered User
    Join Date
    Jun 2011
    Posts
    1

    Need sound help urgently

    Hello everyone,

    I am very new to flash and actionscript and don't know a lot about it so I will post my question here. I have been looking for an answer to this but everything I find is not what I need and I find very complicated. What I need help with is this: I have multiple .mp3 files and I want to make them play in my game I made. The game is very basic and is just a choose your own adventure game.

    I have lots of different scenes, with layers on all of them and my game runs perfectly. What I am in need of is help making music play at the start of each scene, and stop by the end of it.

    Like I said earlier all the code I find is very complicated and I cant follow it easily so is there anyone who can tell me step by step (as basically as possible) how to do this?

    I think what I want is some code so that when the scene starts, the music I designate should play, but I need to turn that music off before the next scene so they dont play at the same time.

    Any help would be greatly appreciated!

    Regards,

    Mark.

  2. #2
    Junior Member
    Join Date
    Jul 2011
    Posts
    5
    You first have to import the music into your library and give it a class name of Drum or such

    function playSound(event:Event):void {
    var drumrum = new Drum();
    var mainSound:SoundChannel = drum.play(0,int.MAX_VALUE);

    }
    playMusic.addEventListener(MouseEvent.CLICK,playSo und);

    playMusic is a button. Then at the end of the scene put the code drum.stop();

    This should work

  3. #3
    Junior Member
    Join Date
    Dec 2011
    Posts
    16
    thanks i was also looking for such script. it realy works

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