Jan 18 2009

AS3 Drop Down Menu Class

Category: DropDownMenu,DropDownMenu ClassHadi Tavakoli @ 3:28 pm

Some call it, combo box but I like to call it a drop down menu! Well, it's my creation and I can name it whatever I like, right?! HaHaHa :) No matter its name, this is going to be a very interesting class and a lot more complicate than the scrollbar we finished yesterday.

I'm not going to build some silly drop down menu which you just can insert some text in it and do some actions when an item is selected! We are going to build a very nice drop list menu which can have different items shown in it! it can load images, text descriptions, etc, etc, because we are going to need these things later in our application.

So, before we get our hands dirty in writting any code, let's spend a couple of minutes and think about the input parameters that we may need for our drop down menu. Here is what I came up with. (Maybe I add some more items, but right now, I can think of these options right now)

var myCombo:DropDownMenu = new DropDownMenu(myCombo_mc);
myCombo.width = 100;
myCombo.floors = 5;
myCombo.floorHeight = 50;
trace(myCombo.position);
myCombo.buttonMode = false;
myCombo.font = "Arial";
myCombo.fontSize = 12;
myCombo.fontColor = "#000000";
myCombo.align = "center";
myCombo.defaultItem.index = 0;
trace(myCombo.selectedItem.data);
trace(myCombo.selectedItem.index);
myCombo.add({lable:"", detail:"", data:"", thumb:""});
 

I think this is good enough to get started with. Maybe you have just guessed rgar the very nice thing we are going to do is to import our Scrollbar class into this drop down menu class! The Scrollbar class took a lot of time to be completed, but I think I am much more comfortable with this, so let's get down to work and see how far we can get with this drop down menu class today.

Regards,
Hadi

Tags: , , , , , , ,

Leave a Reply

*