I created a new AS3 document in Flash CS3.
I opened the "Component" window and dragged a ComboBox onto the stage.
I entered selected the ComboBox and went to the Parameters tab.
Under "dataProvider", I entered 2 separate values, assigned a "label" and a "data" for each value.
So I have now a ComboBox on my stage that has the following two attributes:
label: "Team 1" data: 23
label: "Team 2" data: 24
When I initially dragged the ComboBox onto the stage, it was classified as a MovieClip. Fine, so I gave it the instance name of "teamList_mc"
What I want to do now, is trace out the value of the selected ComboBox option when the user presses a submit button. For example; a user would choose from the ComboBox drop down menu "Team 2", then press submit. Upon pressing submit, it would trace out and display: 24
(note: I also have a MovieClip submit button that you'll notice in the below code)
Here is where I'm having issues.
ActionScript Code:
// How do I get "teamList_mc" to be seen as a ComboBox?
function clickedSubmitScore(event:MouseEvent):void
{
var i:Number = teamList_mc; // of course, this does not work
trace(i);
}
submitScore_mc.addEventListener(MouseEvent.MOUSE_UP, clickedSubmitScore);
Or how about
:
ActionScript Code:
function clickedSubmitScore(event:MouseEvent):void
{
var myComboBox:ComboBox = new ComboBox();
teamList_mc = myComboBox.value; // <-- this is crap, doesn't work
var i:Number = teamList_mc; // <-- this is crap, doesn't work
trace(i);
}
submitScore_mc.addEventListener(MouseEvent.MOUSE_UP, clickedSubmitScore);
All my above coding attempts to pull data value from teamList_mc is a joke. I know I'm just blind as to what the answer is. Are there any sight healers out there? :P