Hey there, im back again.
Since the last bit of help i had, everything is going great for my MP3 player. Now i am just wondering whether someone can help me build a menu system for it, use the very same code you see here below the picture.
Look at this picture, as you can see it has remote functions. What i would like is a menu system, where you can use the directional buttons to highlight the music, and when you press enter it plays the selection. IF possible i would like it to be on the very same page as the current music playing actionscript is on.
Here is the code
//**************************************** SOUND ********************************
//Sets up the sound
var s : Sound = new Sound ();
s.onSoundComplete = playSong;
//sets volume to 75%
var vol : Number = 80;
s.setVolume (vol);
_root.volBar.gotoAndStop (vol);
//Array of songs
var sa : Array = new Array ();
//Currently Playing
var cps : Number = - 1;
//Position of Music
var pos : Number;
//Load songs XML
var xml : XML = new XML ();
xml.ignoreWhite = true;
xml.onLoad = function ()
{
var nodes : Array = this.firstChild.childNodes;
for (var i = 0; i < nodes.length; i ++)
{
sa.push (nodes *.attributes.url);
}
};
xml.load ("songs.xml");
//********************* Functions***********************
//Play MP3
function playSong () : Void
{
s = new Sound ();
if (cps == sa.length - 1)
{
cps = 0;
s.loadSound (sa [cps] , true);
} else
{
s.loadSound (sa [ ++ cps] , true);
}
}
//Pauses the music
function pauseIt () : Void
{
pos = s.position;
s.stop ();
pause = true
}
//Unpauses the music
function unPauseIt () : Void
{
s.start (pos / 1000);
pause = false
}
//Go to previous song
function prevSong () : Void
{
if (cps > 0)
{
cps --;
s.loadSound (sa [cps] , true);
} else
{
cps = sa.length - 1
s.loadSound (sa [ -- cps] , true);
}
}
//**************** Music Controls***********************
//Play Song
_root.remote_mc.play.onRelease = function()
{
if (pause == true)
{
unPauseIt();
}
else if (Stop == true)
{
s.loadSound (sa [cps] , true);
Stop = false;
}
}
//Pause Song
_root.remote_mc.pause.onRelease = function ()
{
pauseIt ();
};
//Next Song
_root.remote_mc.next.onRelease = function ()
{
playSong ();
};
//Prev Song
_root.remote_mc.prev.onRelease = function ()
{
prevSong ();
};
//Prev Song
_root.remote_mc.stop.onRelease = function ()
{
s.stop();
Stop = true;
};
//****************** Volume*********************
//Turn it Down
_root.remote_mc.volume.volDown.onPress = function ()
{
s.setVolume (vol -= 10);
if (vol == - 10)
{
vol = 0;
}
_root.volBar.gotoAndStop (vol);
};
//Turn it Up
_root.remote_mc.volume.volUp.onPress = function ()
{
s.setVolume (vol += 10);
if (vol == 160)
{
vol = 150;
}
_root.volBar.gotoAndStop (vol);
}
First of all, dont worry about the picture, that background is just a rough image which will be improved at another time, and I do know how to get the text to show up from the html. So i wont be needing help with those, it’s just the menu system i need to know about.
Thank you so much