Log in

View Full Version : Dropdown select box or scolling selection



evan
08-04-2008, 07:49 PM
This is the script that I am trying to work with

"myList" is the instance name of the box


myList.addEventListener(Event.CHANGE, itemChange)

function itemChange(e:Event):void
{
trace(myList.selectedItem.label);

}

-that works


what I need to know is what syntax to use for choosing a specific item because I want to trigger an event after a selection

Medyman
08-04-2008, 10:21 PM
I don't see a question in there. Are you asking how to create one from scratch? Instead of the CS3 Combobox component (http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00002626.html)?

evan
08-05-2008, 02:49 PM
I needed to know which component to use thanks -got 90% --see above to clarify my question better

This link (http://www.sitepoint.com/article/script-combobox-component) gives an intro to how to use it.


Here is an as2 tutorial (http://www.flashperfection.com/tutorials/Flash-ComboBox-Interactivity-25222.html)

Any ideas about how to set conditions or trigger different functions based on selections in AS3?

THE ANSWER IS BELOW

evan
08-05-2008, 07:09 PM
This is the AS 3 version:cool:

with this I am navigating inside a movieclip and returning a response using "trace".




var State:String;
myList.addEventListener(Event.CHANGE, itemChange)

function itemChange(e:Event):void
{


//this works
//trace(myList.selectedItem.label);

//this works
//trace(myList.selectedItem);

//this works
State=(myList.selectedItem.label);
trace (State);

if(State=="Chicago"){trace("you are cool");testobject_mc.gotoAndStop(3);}
else{trace("you are not from Chicago");testobject_mc.gotoAndStop(1);}