3 Replies Latest reply on Feb 8, 2008 1:25 PM by clbeech


      I have created a flash movie then imported my music mp3 file to a single frame on the timeline in this layer naming the layer (music).

      When I play the movie the music starts to plays throughout and all is fine, however what I would like to do is create a new layer with a button so the user has an option to click to play the music rather than the music automatically playing once the movie has loaded or opened.

      I have tried many different ways but can’t find the solution to run the script?

      Should I be adding the Action script in to the music frame on in to the button frame?

      I have added the code stopAllSounds to the music frame which stops the music from playing but can’t find the way to get the button to start the music playing again.

      Any help would be appreciated.
        • 1. Re: Script
          hi ghi572000

          if you don't want the music start automatically you just have to make the first frame with the music but in the event put stop and a button saying to go to frame 2 where you put the music playing(event start), here you can have a button saying stop and go to frame 1.

          frame 1 - layer 1: button play (on (Release) {
          gotoAndStop(2);} )

          layer 2: attach music (event stop);
          layer 3: stop

          frame 2 - layer 1: button stop (on (Release) {
          } )
          layer 2: attach music (event play);
          layer 3: stop
          • 2. Re: Script
            ghi572000 Level 1

            I understand how you explained the music to stop and start to play, however the problem I am having now is by putting the buttons in frame 1 with a command go to frame 2 and play, is that when the rest of the movie continues to runs I loose the buttons. How can I get the buttons to remain without having to stretch the layer to the full length of the movie?


            • 3. Re: Script
              clbeech Level 3
              actually the best method to use is a Sound Object instance, and not to attach the sound file to the timeline. here is some instruction on using the Sound class: http://www.flashgods.org/forums/viewtopic.php?f=20&t=86

              as to the buttons, yes you would need to construct a layer that is the full length of the file, OR you could attach the button MC instances to the stage dynamically at runtime and eliminate having to 'place' the in the IDE :)