inicio mail me! sindicaci;ón

DropDown menu class - as3

Hey everyone!
I keep meaning to update this blog with various titbits and stuff, but I never seem to have the time - anyway, thought I’d post up this wee drop down (combo) menu class I decided to build yesterday - It’s not been from any specific project, I just decided that the flash community needs a better dropdown that the horrific one included as standard. Anyway, it’s pretty basic just now, but it’ll do the basics and it’s totally skinable which was my main aim.

EXAMPLE

Usage is pretty simple…

import com.liamr.ui.dropDown.DropDown;
import com.liamr.ui.dropDown.Events.DropDownEvent;

var array:Array = [{label: "Hello World", data:"English - (formal)"},
{label: "Bonjour", data:"French - (formal, for daytime use; 'n' as a nasal vowel)"},
{label: "hej", data:"Danish - (informal; pronounced hey)"},
{label: "dia duit", data:"Gaelic - (informal; pronounced gee-ah ditch; literally 'God be with you')"},
{label: "Hallo", data:"German"},
{label: "ciĆ o", data:"Italian - (pronounced chow; informal)"}];

var dd:DropDown = new DropDown(array, “Please choose…”, true, 100);

dd.addEventListener(DropDown.ITEM_SELECTED, newSelect);

dd.x = 10;

dd.y = 10;

addChild(dd);

function newSelect(e:DropDownEvent):void{

trace(e.selectedId, e.selectedLabel);

label_txt.text = e.selectedLabel;

content_txt.text = e.selectedData;

}

Just drag the DropDown class folder from the example fla, add the code above and you’re there…

enjoy!

SOURCE

3 Responses to “DropDown menu class - as3”

  1. Mike Says:

    Thanks for this :) Really nice - have nice day!

    Cheers, Mike

  2. sam Says:

    Hi Liam,

    Just wanted to thank you for your AS3 dropdown class. It was very much appreciated. I was searching for a lightweight easily skinnable dropdown as I don’t like to use the flash or flex components. Surprising that there is nothing out there. So I was very happy to find yours. It worked a charm, very easily. Only things I would add might be a scrollbar or auto-complete/keyselect when focus in main textbox - if I have time to add that I will reply with a link to the updated code.

    Also, glad you use TweenMax as I use that too for animation and I could use my latest version with no problems with your drop down.

    Again thank you very much for sharing and I very much appreciate your clean code and efforts!! :)

  3. Ruben Oliveira Says:

    Great code! Thanks

Leave a Reply