Easy MP3 Players
This collection of MP3 player components are designed to be easy to use. You can load any standard MP3 file and easily specify parameters to display track properties, such as the title and artist. The audio can be looped when completed and you can set an initial volume level. The spectrum EQ animation is also customizable – with parameters for colors, mode, and the number of displayed bars/peaks.
This component will be included in a future installer of SWiSH Max2 and SWiSH miniMax2, but for now please download this component here – swishzone_simplemp3
Unzip the files into the components folder in your SWiSH Max2 or SWiSH miniMax2 program folder. Unless you changed the default installation folder, the file path would typically be:
C:\Program Files\SWiSH Max2\components\
or,
C:\Program Files\SWiSH miniMax2\components\
If you are running Max2 (or miniMax) when you copy the component, you may need to refresh the component tree by right clicking on the tree in the Components panel then selecting ‘Reload’. To use the component, simply drag it into your movie.
Important
The Flash Player only supports MP3 files that have a frequency of 11kHz, 22kHz, or 44kHz.
Usage Instructions
From the Components panel, navigate to Multimedia -> Audio Players, then drag this component onto the Stage.
To modify the audio player itself, select the “SimpleMP3_#” MovieClip in the Outline and open the Parameters panel. Add the URL to your MP3 file in the MP3 URL filed as either an absolute or relative file path (see Setting the MP3 URL, below). Then modify the other parameters to suit your needs.
To modify the settings for the SpectrumEQ component, open the SimpleMP3_# MovieClip in the Outline by pressing the arrow icon to the left of it. Then, select the “SpectrumEQ” MovieClip and open the Parameters panel.
Setting the MP3 URL
It is important to note that if a relative file path is used for the MP3 URL parameter, it will be referenced relative to the HTML page itself.
If you want to test the component inside SWiSH Max2/SWiSH miniMax2, you will need to specify the LoadMovie folder in your preferences: Tools Menu -> Preferences -> Player -> Test/Load movie folder. Again, the folder you specify will be used as the root file path. The MP3 file will be loaded relative to that folder (based on what you enter in the MP3 URL parameter).
Using the Event Notification
In the parameters for the SimpleMP3 component, you can define an Event Notification function. This is the name of a function that you manually add to your own movie. When the audio finishes playing, it will ‘call’ this function (using a path relative to component’s parent timeline). It will send two arguments in the function callback: 1) The name of the component MovieClip; and, 2) The boolean value of “true” (without quotes).
For example, if you entered “myEvent” in the OnComplete parameter field (without quotes), then in the component’s parent timeline you could add a function like this:
function myEvent(name, isDone) {
if (isDone) {
trace("The audio in " + name + " has finished playing!");
}
}
Then when you play your movie inside SWiSH Max2, you will see something similar to the following on the Debug panel:
The audio in SimpleMP3_01 has finished playing!
You can use this Event Notification function to perform different actions when the audio finishes playing – such as opening a new browser window, etc.
I hope you enjoy using this component, and please post comments or questions if you need assistance.
Audio Player Parameters
| Parameter | Description |
| General Settings | Group: General settings for this component |
| MP3 URL | The URL (file path) to the MP3 file |
| Track Title | The title of the audio file |
| Track Artist | The artist of the audio file |
| Starting Volume | The initial volume level |
| Loop Audio? | Whether you want the audio file to repeat when it finishes playing |
| Load on Start? | Whether you want the audio file to load immediately or when the user presses the Play button |
| Color Settings (see notes below) | Group: Settings for the color scheme of this component |
| Interface Color | Overall color of the interface |
| Text Color | Color of the text |
| Button Up Color | Color of the buttons when the mouse is not over them |
| Button Over Color | Color of the buttons when the mouse moves over top of them |
| Event Notification | Group: Event notification settings |
| OnComplete | A function in the component’s parent timeline that is called when the audio finishes playing. Arguments sent are the name of the component and a boolean value of True. For example: eventCallback(componentName, true) |
Note: The Color Settings parameters are not available to all styles of the SimpleMP3 component. At this time, only SimpleMP3_03 has customizable color settings. More variations are likely to be added at some point in the future.
EQ Parameters
| Parameter | Description |
| General Settings | Group: General Component Settings |
| EQ Width (read-only) | The width of the EQ (read-only) |
| EQ Height (read-only) | The height of the EQ (read-only) |
| EQ Bars | Number of EQ Bars/Peaks to display |
| EQ Mode | Select the display mode of the EQ animation |
| Color Settings | Group: Parameters to adjust the colors of the EQ |
| Line Color | The line color of the EQ bars/peaks |
| Top Color | The color at the top of the EQ bars/peaks |
| Middle Color | The color in the middle of the EQ bars/peaks |
| Bottom Color | The color at the bottom of the EQ bars/peaks |
| Glow Settings | Group: Settings for the glow around the EQ (requires SWF8+) |
| Use Glow? | Adds a colored glow around the EQ animation (requires SWF8+) |
| Glow Color | The color of the glow |
| Glow Alpha | Transparency of the glow |
Audio Player Methods
| Parameter | Description |
| loadAudio(filePath) | Tells the component to load an MP3 file specified by the filePath variable:e.g. SimpleMP3_01.loadAudio(”my-audio.mp3″); |
| displayInfo(artist, title) | Changes the displayed audio information (artist and title):e.g. SimpleMP3_01.displayInfo(”Singer Guy”, “A Song About Something”); |
| playAudio() | Starts playing the audio file:e.g. SimpleMP3_01.playAudio(); |
| stopAudio() | Stops the audio file and rewinds it to the start:e.g. SimpleMP3_01.stopAudio(); |
| pauseAudio() | Pauses or resumes (if previously paused) the audio file at its current position:e.g. SimpleMP3_01.pauseAudio(); |
Tags: audio, components, Max2, miniMax2, Multimedia, player


(16 votes, average: 4.81 out of 5)



Anyway to load a LIST of MP3? I want a simple player to play many mp3s.
Odoggz
If you are looking for a player with the ability to play multiple mp3s you may be interested in SWiSH Jukebox2 there are a wide variety of players to choose from and it’s very affordable
Nice work, I have been having fun with the color options in the 3rd player (the only one without a user volume control I guess :))
It can become almost invisible if you make the background color the same as your base movie/html page, delete the equaliser and don’t enter the artist and title info, it becomes a timer and 3 buttons.
david
Please why don’t you change the mp3 player like the one I have on my website and put some image slider in asimple of the flash
I know swishzone for long time and just few days a go I have bought their product please change some pre made samples .
function myEvent(name, isDone) {
if (isDone) {
trace(”The audio in ” + name + ” has finished playing!”);
}
}
It’s php right?
No, it’s Actionscript / SWiSH Script / ECMA script. (ECMA script is the standard upon which Javascript, Action Script, and SWiSH Max’s scripting language is based upon. While this code snippet looks similar, you can see the (a) the trace() function does not exist in php, and (b) + is not uses for string concatenations in PHP.
Awesome, I’m bookmarking this tip!!