473,387 Members | 3,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

mp3 player with 3 listboxes and category/subcategory

Hi,

I am trying to hack this mp3 player so that it displays 3 levels of hierarchy instead of 2. Check out the current player here http://www.yanwhite.com/staging/GetGoodMusic/music.htm

Currently it has kind of 3 levels, but using 2 buttons for the top level.
I want all 3 as list boxes. So that listbox1 has main categories, listbox2 displays subcategories and listbox3 displays the tracks.

Here is the actionscript..

//setting it up
//change path to your own
path = "http://billwatson2.no-ip.info/public/flash/music/";
loadBB.setLabel("By Mood");
loadB.setLabel("By Genre");
pause.setLabel("Pause");
playB.setLabel("Play");
pause.setEnabled(false);
playB.setEnabled(false);
//constucting menu system
//next few functions just allow 1 listbox to chat to the other
function Labels() {
this.lab = new Array(0);
this.dat = new Array(0);
}
Labels.prototype.addLabel = function(name, value) {
this.lab.push(name);
this.dat.push(value);
};
Labels.prototype.change = function(obj) {
var i;
obj.removeAll();
for (i=0; i<this.dat.length; i++) {
obj.addItem(this.lab[i], this.dat[i]);
}
obj.setScrollPosition(0);
};
FlistBoxClass.prototype.changeLabels = function() {
this.getValue().change(this.sub);
};
FlistBoxClass.prototype.setSubMenu = function(sub, label, x, y) {
label.change(this);
this.sub = sub;
this.setChangeHandler("changeLabels", this);
this.setSubIndex(x, y);
};
FlistBoxClass.prototype.setSubIndex = function(x, y) {
this.setSelectedIndex(x);
this.sub.setSelectedIndex(y);
};
//change what you like here to add your own artists and songs
//just make sure the title of the song is the same as the name of the mp3
//eg for myGreatSong.mp3 add the title as myGreatSong
//the data being added to the listbox is for demonstration only as no use is made of it
menu = new Labels();
menu.addLabel("Dire Straits", submenu=new Labels());
submenu.addLabel("Sultans of Swing", 1);
submenu.addLabel("Money for Nothing", 2);
submenu.addLabel("Romeo and Juliet", 3);
submenu.addLabel("Telegraph Road", 4);
submenu.addLabel("I Want my MTV", 4);
menu.addLabel("Eagles", submenu=new Labels());
submenu.addLabel("Desperado", 1);
submenu.addLabel("Hotel California - Unplugged", 2);
submenu.addLabel("Lying Eyes", 3);
submenu.addLabel("New Kid In Town", 4);
submenu.addLabel("On the Border - Already Gone", 5);
submenu.addLabel("Take It To The Limit", 6);
submenu.addLabel("Peaceful, Easy Feeling", 7);
submenu.addLabel("Take it Easy", 8);
submenu.addLabel("Tequila Sunrise", 9);
menu.addLabel("The Beatles", submenu=new Labels());
submenu.addLabel("Come Together", 1);
submenu.addLabel("Here Comes the Sun", 2);
submenu.addLabel("Hey Jude", 3);
submenu.addLabel("Lady Madonna", 4);
submenu.addLabel("Lucy In the Sky With Diamonds", 5);
submenu.addLabel("Maxwell's Silver Hammer", 6);
submenu.addLabel("Octopus's Garden", 7);
submenu.addLabel("Revolution 1", 8);
submenu.addLabel("While My Guitar Gently Weeps", 9);
menu.addLabel("Bob Marley", submenu=new Labels());
submenu.addLabel("No Woman No Cry", 1);
submenu.addLabel("Jammin", 2);
submenu.addLabel("Exodus", 3);
menu.addLabel("Bob Dylan", submenu=new Labels());
submenu.addLabel("Like A Rolling Stone", 1);
submenu.addLabel("Mr Tamborine Man", 2);
menu.addLabel("Rolling Stones", submenu=new Labels());
submenu.addLabel("Wild Horses", 2);
menu2 = new Labels();
menu2.addLabel("Dire Straits", submenu=new Labels());
submenu.addLabel("Sultans of Swing", 1);
submenu.addLabel("Money for Nothing", 2);
submenu.addLabel("Romeo and Juliet", 3);
//formatting buttons and listboxes....change to suit
aformat = new FStyleFormat();
aformat.textSize = 12;
aformat.textColor = 0xffff00;
aformat.textBold = false;
aformat.textUnderline = false;
aformat.textFont = "Arial";
aformat.face = 0x000000;
aformat.arrow = 0xffffff;
aformat.highlight = 0x0000ff;
aformat.highlight3D = 0x0000ff;
aformat.darkshadow = 0x0000ff;
aformat.shadow = 0x0000ff;
aformat.background = 0x123456;
aformat.selection = 0xffffff;
aformat.selectionUnfocused = 0xff0000;
aformat.textSelected = 0x0000ff;
aformat.applyChanges();
aformat.addListener(playB, pause, loadB, loadBB, artists, titles);
//titles list box handler
titles.setChangeHandler("playsongs");
function playsongs() {
s.stop();
delete s;
playB.setEnabled(true);
playB.setLabel("Play");
pause.setLabel("Pause");
pause.setEnabled(false);
loadB.setEnabled(true);
loadB2.setEnabled(true);
loaded = true;
paused = false;
}
//code for buttons
loadB.onRelease = function() {
artists.setSubMenu(titles, menu, 0, 0);
};
loadBB.onRelease = function() {
artists.setSubMenu(titles, menu2, 0, 0);
};
playB.onRelease = function() {
if (loaded) {
theSong = path+titles.getSelectedItem().label+".mp3";
s = new Sound(this);
s.loadSound(theSong, true);
s.setVolume(volSlide._x - 230);
s.start(0,1);
playB.setLabel("Stop");
pause.setEnabled(true);
} else {
s.stop();
pause.setEnabled(false);
playB.setLabel("Start Again");
}
loaded = !loaded;
};
pause.onRelease = function() {
if (!paused) {
s.stop();
playB.setEnabled(false);
stopped = s.position/1000;
this.setLabel("Continue");
} else {
this.setLabel("Pause");
s.start(stopped,1);
playB.setEnabled(true);
}
paused = !paused;
};
volSlide.onPress = function() {
volSlide.startDrag(true, 242, 274, 342, 274);
volSlide.onEnterFrame = function() {
s.setVolume(volslide._x - 242);
};
};
volSlide.onRollOut = volslide.onRelease = volslide.onReleaseOutside = function() {
stopDrag();
};
panSlide.onPress = function() {
panSlide.startDrag(true, 431, 274, 531, 274);
panSlide.onEnterFrame = function() {
s.setPan(panslide._x - 431);
};
};
panSlide.onRollOut = panslide.onRelease = panslide.onReleaseOutside = function() {
stopDrag();
};
Jun 23 '07 #1
2 1950
kestrel
1,071 Expert 1GB
Im sorry, but i can't solve this problem for you. Do you have any specific problems with a small portion of code?
Jun 23 '07 #2
[quote=waterox]Hi,

I am trying to hack this mp3 player so that it displays 3 levels of hierarchy instead of 2. Check out the current player here http://www.yanwhite.com/staging/GetGoodMusic/music.htm

Currently it has kind of 3 levels, but using 2 buttons for the top level.
I want all 3 as list boxes. So that listbox1 has main categories, listbox2 displays subcategories and listbox3 displays the tracks.

Oops I forgot to post the right page up.. the player is now there at http://www.yanwhite.com/staging/GetGoodMusic/music.htm
Jun 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Brian Murphy | last post by:
<?php /* I need your help. I'd be very thankfull if write me this script.I need a script that displays a list of categories and subcategories like this: <select name="category"> <option...
5
by: Travis Pupkin | last post by:
Hey, I've done a number of product catalogs/galleries with one or two category levels (Category > Subcategory). The straightforward way to do this, of course, is to use database fields for...
3
by: Rich Protzel | last post by:
Hello, So my table contains say 100,000 records, and I need to group the categories in fld1 by the highest count of subcategories. Say fld1 contains categories A, B, C, D, E. All of these...
2
by: shane-dated-1130371478.43db8f | last post by:
Hello all, I am working on a website for a bookstore and have run into a bit of a snag. I am trying to write a form where an admin can set the category for a book. However, categories can be of...
0
by: Paul Hendryx | last post by:
I have the table structure: CREATE TABLE . ( IDENTITY (1, 1) NOT NULL , NOT NULL , NULL , (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ) ON GO
0
by: Luis Esteban Valencia | last post by:
have a problem and I'm not sure how to handle/fix it. I have three listboxes on my page. The first listbox has a list of software products. When you select an item in the Products listbox, then...
1
by: vinayg | last post by:
how can i search subcategory wise for a particular category,i want to display items.suppose user selected a particular category.I want to display all items in that category + its subcategories. ...
34
gcoaster
by: gcoaster | last post by:
Hello Everyone! I have a question regarding "cascading combobox(s) list(s)" I would like: ComboBox 2 to show results from ComboBox 1's selection, then ComboBox 4 to show results from...
2
by: theS70RM | last post by:
Hi, I have a table thats laid out something like the following.... cat_id, cat_name, cat_parent 1 furniture null 2 electrical null 3 tvs 2 4 desks ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.