How to Make an Embedded XML Playlist

How to Make an Embedded XML Playlist thumbnail
Make an embedded XML playlist of the music your children play.

XML playlists are lists that are stored in files that are formatted with the XML markup language. An XML playlist stores the location of multimedia files like music, animation and video files in XML tag variables. These file names can be the URL file location on a remote server or the directory location on your own computer. Application programs, such as music players, load the XML playlist file (embed the file into a XML program object). A player that is programmed to access the music file location in the XML object can then play the associated songs.

Things You'll Need

  • Adobe Flash Professional: CS3, CS4 or CS5 versions
Show More

Instructions

    • 1

      Create a text file with a text editor. Save the text file as "music_playlist.xml."

    • 2

      Type into the text editor the XML playlist with the file names of the music, video or animations you want to access in the playlist.

      <?xml version="1.0" encoding="UTF-8"?>

      <playlist>

      <file_location>http://www.yourwebsite.com/first-recital.mp3</file_location>

      <file_location>http://www.yourwebsite.com/second-recital.mp3</file_location>

      </playlist>

      Add music or other multimedia files to your XML file as needed. Add a file_location tag for each multimedia file you want to add.

    • 3

      Start the Flash program. Click "Flash File (ActionScript 3.0)" from the splash window to create a new file for the AS3 Flash.

    • 4

      Select "Actions" from the "Window" menu on the main Flash menu bar to open the ActionScript 3 editor. Position your mouse cursor on the first line of the ActionScript 3 editor. Click your mouse button, and type in the code below to create a URLLoader object that will be used to load a request and store the raw binary contents of the XML file:

      var loader:URLLoader = new URLLoader();

      var request:URLRequest = new URLRequest("music_playlist.xml");

      loader.load(request);

    • 5

      Type the code starting at the next line of the ActionScript 3 editor to detect when the XML playlist file has finished loading. Attach an event listener to the URLLoader object that will detect when the text data in the XML file has been transferred to the URLLoader object (loader) from the music_playlist.xml file.

      loader.addEventListener(Event.COMPLETE, onComplete);

    • 6

      Type the code starting at the next line of the ActionScript 3 editor to transfer the contents of the data stored in the URLLoader variable to an XML variable called "fileXML":

      function onComplete(event:Event):void

      {

      var loader:URLLoader = event.target as URLLoader; var fileXML = new XML(loader.data);

      }

      The above code in the onComplete function is executed when the event listener signals that the "music_playlist.xml" file has been successfully embedded into the Flash program. The code declares a new URLLoader object that is used to store the music_playlist.xml file. The data in that variable is then loaded into the XML variable named "fileXML."

Related Searches:

References

Resources

  • Photo Credit Ralf Nau/Digital Vision/Getty Images

Comments

Related Ads

Featured