Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-28-2007, 05:46 PM   #1
xwielder
Senior Member
 
Join Date: Aug 2007
Location: NE Ohio
Posts: 520
Send a message via AIM to xwielder
Default ComboBox hell

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
xwielder is offline   Reply With Quote
Old 08-28-2007, 07:13 PM   #2
xwielder
Senior Member
 
Join Date: Aug 2007
Location: NE Ohio
Posts: 520
Send a message via AIM to xwielder
Default

ActionScript Code:
var totalTeams:Number = 2; var teamList:ComboBox = teamList; for(var i:Number = 0; i < totalTeams; i++) {     teamList.addItem({label:"Team " + (i + 1), data:(i + 1)}); };
ActionScript Code:
function clickedSubmitScore(event:MouseEvent):void {     trace(teamList.value); } submitScore_mc.addEventListener(MouseEvent.MOUSE_UP, clickedSubmitScore);

I basically changed "teamList_mc" to "teamList", then made "var teamList:ComboBox = teamList;"

I'm a C++ coder from the core, and am soon realizing day to day that C++ is FAR different than coding Flash CS3 AS3.
With Flash, you have to consider not only the actual AS code, but you're dealing with a "timeline" and "stage" as well.

Funky stuff.


Anyway, I'm just posting to say that I've figured out my original issue (see above code).

Thanks to all who viewed this post!
xwielder is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
combobox with timer delay little_prince41 Components 5 08-02-2007 02:44 AM
Changing the selected item in a combobox mcmcom Components 3 07-28-2006 11:42 AM
ComboBox Hell cjhsb Components 13 06-25-2005 11:43 AM
ComboBox Hell Renee Components 6 03-10-2005 12:39 AM
[mx] combobox, focus & keypad arrows chartrandi Components 0 03-31-2004 11:12 AM


All times are GMT. The time now is 04:32 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.