Mp3Jukbox Constructor

Version 1
Mp3Jukebox - Class constructor function

Description

resource Mp3Jukebox (playlist:String [, 56k_playlist:String [, base_movie:MovieClip [, width:Number [, height:Number]]]])

Mp3Jukebox() is the class constructor and therefore is called when you initialize the class. The playlist is an XML file that must contain the song, artist, source of the mp3 and the song length in milliseonds. This song length is needed to workaround the loader bar displaying properly in proportion to the song length. A workaround is currently being investigated. The 56K playlist is another XML file with the same layout as the main playlist but provides the opportunity to load lower-bandwidth songs, fewer songs or even a completely different playlist altogether. If this is left empty, it uses the main playlist for low-bandwidth users.

The base_movie can be the movie level which you want the Mp3Jukebox to load on. If left empty it will randomly generate a level above 100 to generate itself on a MovieClip called "base". I have considered changing it to call getNextHighestDepth() but I'd rather suprise you if don't feel like specifying a level.

Width and height call setSize(). If either is specified, both are passed along, null or not. I coded this but havn't actually checked what would happen if you only specify one. I'm going back to completely re-code the setSize anyway, so just specify both for now and I'll write some code that will size proportionally for the next version.

Example 1:

This is the easiest way to get started with the player. Simply construct the player and pass one playlist as the only argument. The player will create its own base MovieClip, locate the movie and itself at 0,0 and load and play the default playlist. A complete Mp3Jukebox with only one line of code!
//Construct player and load playlist
var player:Mp3Jukebox = new Mp3Jukebox("playlist.xml");

Example 2:

The following code loads the Mp3Jukebox as "player" then moves it 60px from the left and 90px from the top. The volumne (and its slider) is set to 80% and the layout is re-initialized (after being initialized by the class constructor), sized 500px wide by 80 high and the main color is changed to pure red.
//Create player
var player:Mp3Jukebox = new Mp3Jukebox("playlist.xml", "playlist_dialup.xml");

//Use to move controls/readout to specified x,y
player.moveTo(60, 90);

//Set volume. 0-100 can be used.
player.setSongVolume(80);

//Use to set layout size and button color
player.initLayout(500, 80, 0xFF0000);

See also: initLayout()

Home

Public Functions