2 Replies Latest reply on Jun 18, 2009 8:20 PM by nosmokingbandit

    Need help embedding a mp3 player swf with xml playlist

    nosmokingbandit

      Im a noob to Flash (started tuesday, haha) and so far everything is coming along just fine, but i need to put music in the swf. I have a button set up that slides a swf mp3 player in from the side but i dont know how to make the playlist work with it.

      The player is from this site:

      http://www.bezzmedia.com/swfspot/samples/flash8/Mp3_Player_with_XML_Playlist

       

      Using the xml playlist with html is simple enough, but im not sure how to use it with Flash Catalyst. Is there an easy way to do this?

       

      My original plan was to have a text list of the songs with a play button next to each one, then when you click on the play button it would set the state of any other songs to Stopped so you can just pick what song to play and if another song was playing it would stop. Im not sure how to do this either (like i said, i started learning this week), so i just tried embedding someone else's (ugly) mp3 player.

       

      Anyway, if anyone knows a relatively easy way to have a playlist in my swf please let me know. Thanks!

        • 1. Re: Need help embedding a mp3 player swf with xml playlist
          Mark E. Shepherd Adobe Employee

          If I understand you correctly, you've imported a SWF into Catalyst using Import Artwork on the File menu. When your app runs, you want to pass that swf a parameter that tells it what URL to read a data file from. The SWF is not one that you've created, rather, you got it from some web site.

           

          This is not something that you can do in Catalyst. However it should be possible to do in Flash Builder. I found an article discussing several ways to do it, at http://www.actionscript.org/forums/showthread.php3?t=175951. One idea is the following code snippet


          <fx:Script>
              <![CDATA[
              import flash.events.*;

           

              private function setVars(event):void
              {
                 
                  event.target.content.yyyyyy = "zzzzzz";
              }
              ]]>
          </fx:Script>
          <mx:Image source="xxxxx" complete="setVars(event)" />

           

          where "xxxxx" is the path of the SWF (you can put it somewhere in your Flash Builder project, or reference it via an URL), and yyyyy is the name of the parameter that the SWF expects, and zzzzzz is the path to the data file. The <Image> tag is what Catalyst created when you imported the SWF. (btw.the Image and SWFLoader tags are almost identical).

           

          I hope this gives you enough info to make progress.

          • 2. Re: Need help embedding a mp3 player swf with xml playlist
            nosmokingbandit Level 1

            Thats exactly what i am looking for. Thanks so much for the help.