Wednesday, January 29, 2014

Flash Multiple Track Mp3 Player Tutorial

Flash driven MP3 players add a new level of satisfaction to the user experience.
Flash allows web developers to add levels of interactivity to their websites that were previously impossible. One of the most popular ways to make use of the power of Flash is to add MP3 player applications that stream multiple tracks that the user can control to enhance the website experience. The process for creating a multiple track MP3 player is relatively simple, even for a novice user.

Instructions


Programming the MP3 Playlist


1
Open a new "Notepad" document and paste the following code:
2
Type the MP3 file information between the and tags using this syntax:
3
Add a new line of code for each MP3 file to be used for the Flash player.
4
Verify that the code has the proper syntax:
5
Save the file as "playlist.xml" in a new folder called "Mp3Player."

Import Playlist to Flash


6
Open a new actionscript2 Flash document.
7
Create four buttons using the "Text" and "Rectangle" tools: "Play," "Pause," "Next" and "Stop."
8
Type an instance name for each of the buttons using the following syntax:
btn_play
btn_stop
btn_prev
btn_next
9
Create a "Dynamic" text field on the stage and give it an instance name of display_txt.
10
Insert a new layer in the "Layers" panel and rename it "a."
11
Select frame 1 of "a," press F9, then type "stop();" without the quotation marks in the actionscript panel.
12
Paste the following code below "stop();" of the actionscript panel:
playlist= new XML();
playlist.ignoreWhite=true;
playlist.onload = function (success) {
if(success) {
_global.songname = [];
_global.songfile = [];
for (var i=0; i0) {
delete this.onEnterFrame;
this._parent.display_txt.text=name;
} else {
this._parent.display_txt.text=\"loading...\"
}
}
this.sound_obj.onSoundComplete = function () {
(song_nr==songfile.length-1)? _global.song_nr=0 : _global.song_nr++;
_root.sound_mc.songStarter(songfile[song_nr],songname[song_nr]);
}
}
btn_play.onRelease = function () {
this._parent.sound_mc.songStarter(songfile[song_nr],songname[song_nr]);
}
btn_stop.onRelease = function() {
this._parent.sound_mc.sound_obj.stop();
}
btn_next.onRelease = function () {
(song_nr==songfile.length-1)? _global.song_nr=0 : _global.song_nr++;
_root.sound_mc.songStarter(songfile[song_nr],songname[song_nr]);
}
btn_prev.onRelease = function () {
(song_nr==0)? _global.song_nr=songfile.length-1 : _global.song_nr--;
_root.sound_mc.songStarter(songfile[song_nr],songname[song_nr]);
}
playlist.load(\"playlist.xml\");
13
Save the Flash document in the "Mp3Player" folder that you created earlier.
14
Press CTRL+Enter to test the finished MP3 player.







Related Posts:




  • Build A Flash Audio Player

    Adding music and sound to your website is simple with a Flash MP3 player.When visitors come to your website, you want to provide content that is engaging and encourages them to stay a while. Addin...


  • Create A Flash Movie Player With Flash Cs4

    Create a Flash Movie Player With Flash CS4Adobe Flash CS4 has become a favorite tool for web developers who want to create rich interactive media experiences for people who visit Flash-enabled web...


  • Create A Flash Player Web Page

    Most websites are built using coding languages like HTML, which stands for HyperText Markup Language. However, using the Adobe Flash application, you can design interactive sites with different el...


  • Build An Mp3 Player In As3

    Turn your computer into a jukebox with Flash.To create a MP3 player in Flash--a Flash application that lets you play different songs--you can use the latest version of the Flash programming langua...


  • Use Audio Players In Flash

    Install music in your webpage by using Adobe Flash.Flash is an Adobe product that allows the user to create interactive multimedia. Flash creations can be embedded in the HTML of a website to add...

Tags: flash, multiple, track, player, _global song_nr, onRelease function, song_nr songname, song_nr songname song_nr, songfile song_nr, songfile song_nr songname