4 Replies Latest reply on Aug 17, 2008 5:00 AM by Dig

    MP3 Player

    Dig
      Hi:

      I have Flash CS3 (9) and need some simple help.

      I need to create a simple MP3 player to play 1 song. The idea is to have this used several times on the website to play differnent audio clips from different products.

      Trying this I created a button and used the Play and Stop buttons from the library on top of a square background.

      I then clicked on Hit for the play button and told it what song to play using the start command and then clicked on the hit for the stop button chose the same song and told it to stop. When I ran the file the start button works fine but the stop button does nothing.

      Any help here is appreciated. I am sure there has to be an easy way to do this.

      Thank again.
        • 1. Re: MP3 Player
          Shandy Elliott Level 1
          Tons of ways to do this, but most suggestions of code depend on how you have your flash file and time line set up. Can you upload your flash file so I could apply code to it?
          • 2. Re: MP3 Player
            Dig Level 1
            Hi: Thanks for answering my question. I found a player on the web that I could use. I downloaded it and was able to change the song but I do not know how to make it not automatically play when it is displayed.

            I attached the code from two areas of the fla (I did not know how to attache the fla to this response). That is all the code I can find but I do not know what to change to make it not automatically play.

            I want to the user to have to click on the play button to start the song.

            Anyway thanks a mil for the help.
            Dig.
            • 3. MP3 Player
              Shandy Elliott Level 1
              dd.loadSound(" http://www.relicpro.com/shine/shine.mp3", true);

              is the code that initiates the sound to play. Since you have the "stream" parameter set to true, I do not believe you can stop it from automatically playing. If you set it to false, Flash will not play the sound until it's completely loaded. If you want the user to control whether they want to hear sound or not, I would create a function using parts of the action script and have the user click a button to load the sound if they want it. You can either place this code on another button that reads "load sound" or "play sound", or you can place the code in the function called playit()

              Since the following code is what initiates the audio, you can move this code around

              dd = new Sound();
              dd.loadSound(" http://www.relicpro.com/shine/shine.mp3", true);
              xx = bar._width;
              orginal_width = bar._width;
              _root.soundbtndis._visible = false;
              _root.soundbtndis.disabled = true;

              so your code would change as follows

              EDIT: Your "play" button would have to call the function of playit(), so there has to be other code that you missed and didn't paste here. Look for the code to be on a frame somewhere or maybe even on the symbol itseld (play button). Make sure that play button is calling playit() on a release of some kind.

              If you are still having trouble, upload the fla file to a server somewhere and send me the link, or you can email the fla file to me.
              • 4. MP3 Player
                Dig Level 1
                Thanks a million for your time. Everything is cool now. Have a great day and again thanks for being willing to take time to help out.

                Thanks