Skip to main content
October 20, 2007
Question

Combo Box Help

  • October 20, 2007
  • 20 replies
  • 1652 views
So in my flash player i have 2 frames

on the first frame i have combo box that has 2 choices

one choice would make it go to the first frame, which it is already on it
and the second choice makes it go to frame 2

on frame 2, i would like the same combo box, but just the choices flipped, of course

so can you explain to me how i can do this?
and please be as specific as possible
im a complete noob to actionscript

thanx!
This topic has been closed for replies.

20 replies

kglad
Community Expert
Community Expert
November 2, 2007
i can't see either of those functions executing with the code you've shown.
kglad
Community Expert
Community Expert
October 29, 2007
you're welcome.
Participant
November 2, 2007
HI

ONe question about xml and combo's : how can I fill them via a xml file
An then triggering eacht choice to start a function for creatiing a new object
See my thread at : http://www.kirupa.com/forum/showthread.php?t=279646

When I use this :
import fl.controls.ComboBox;
import fl.data.DataProvider;

var dp:DataProvider = new DataProvider();
dp.addItem({label:"item 1a"});
dp.addItem({label:"item 2a"});

var myComboBox:ComboBox = new ComboBox()
myComboBox.dataProvider = dp;
myComboBox.move(10, 10);
addChild(myComboBox);


function test(event:Event):void{
myComboBox.labelFunction = nameLabelFunction;

}
myComboBox.addEventListener (Event.UNLOAD, test);



function nameLabelFunction(item:Object):String {
trace(item.label);
return item.label;
}

Evey change is traced but sometimes I get all the items... Any ideas??
Ciao
October 29, 2007
oh okay, i see what it does, even on frame 2 if i click it, it goes bak to frame 1! thanx!
October 29, 2007
oops, ignore
October 29, 2007
oops, ignore
kglad
Community Expert
Community Expert
October 29, 2007
1. i thought that's what you wanted: if you click the 2nd choice, you goto frame 2. if you click the first choice, you goto frame 1.

2. to eliminate the output, remove or comment out the trace() function.

3. i don't understand that last paragraph. but if you want the combobox to display the 1st item on frame 1 and the 2nd on frame 2, use:

dropdown.selectedIndex = 1; // on frame 2

dropdown.selectedIndex = 0; // on frame 1
October 25, 2007
it says:

_level0.dropdown
kglad
Community Expert
Community Expert
October 29, 2007
my mistake:

October 29, 2007
okay thanx that fixed it!

but now
when i click the second choice, to go to the second frame, the output is:
_level0 : 2 : 1

and also, how can i get the output to stop

and i would like for when it goes to frame 2, the combo box would be switched to the second choice in frame 1 would be the first in frame 2
kglad
Community Expert
Community Expert
October 24, 2007
then your combobox doesn't have an path/instance name of dropdown from the timeline that contains that code.

is the code and the combobox on the same timeline? is yes, click on the combobox and check the properties panel to look for typos or case mismatches.
October 24, 2007
so i only have one layer on my timeline

the combobox's instance is dropdown

there must be somethin im missing!
kglad
Community Expert
Community Expert
October 24, 2007
below your dropdown.addEventListener code add:

trace(dropdown)

and paste the output.
October 23, 2007
i hit test movie
and then clicked on the dropdown box and tried to change frames
but no output came...
kglad
Community Expert
Community Expert
October 23, 2007
you have to click on a dropdown selection.