initLayout

Version 1
initLayout - creates objects and funtions for playback control

Description

boolean initLayout ( [width:Number [, height:Number [, color:Number ]]])

initLayout() creates the buttons and functions that control the playback songs. Previous song, stop, play, pause, next song and the song title TextField are all drawn on individual MovieClips and given onRelease functions. The script also calls the private functions makeTimeSlider, makeTimeReadout and makeVolume. You can guess what those functions do.

initLayout will return false if the interface has already been drawn and it has to delete and recreate the individual clips. Don't ask me why I did this, even I'm not sure.

All arguments are optional for initLayout. Width and height, if not specified are taken from the global size (not yet implemented). The color is a hex formatted (0x000000) number that will serve as the base, background color for the buttons. Better support for shadows and highlights are forthcoming. Feelings on passing objects vs more arguments and dynamically determining shadows and highlights versus passing them are welcome and appreciated.

Example:

This creates an instance of the Mp3Jukebox and reassigns it a new width, height and color. As previously mentioned, width and height aren't functional yet. This is mostly just to screw with people but partly because it's not neccessary with this version of the function.
//Construct player and load playlist
var player:Mp3Jukebox = new Mp3Jukebox("playlist.xml");

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

See also: Mp3Jukebox(), setSize()

Home

Public Functions