richiemartin
Technical User
Hello again! As explained before I am new to Flash mx2004 and am struggling to understand the principles behind selecting an item from a component using Action Script.
I have set up a simple Combo Box with three options. My objective is that when one of the options is selected, it takes the user to a new frame. I have tried various different bits of code with various levels of success. On one attempt, I got the combo box to work, but it took me to the same frame, whatever selection I made in the combo box. I have gone round in so many circles that the code I now have does not work. This code (attached) was put together from various books and help menus:
myComboBox.addItem("Image1");
myComboBox.addItem("Image2");
myComboBox.addItem("Image3");
myComboboxListener = new Object ();
comboboxListener.change = function (eventObj){
var eventSource = eventObj.target;
var theSelectedItem = eventSource.selectedItem;
var theSelectedItemLabel = theSelectedItem.label;
gotoAndStop (5);
}
myComboBox.addEventListener("change", comboboxListener);
Please can someone explain to me what I’m doing wrong. Your time and help is much appreciated.
I have set up a simple Combo Box with three options. My objective is that when one of the options is selected, it takes the user to a new frame. I have tried various different bits of code with various levels of success. On one attempt, I got the combo box to work, but it took me to the same frame, whatever selection I made in the combo box. I have gone round in so many circles that the code I now have does not work. This code (attached) was put together from various books and help menus:
myComboBox.addItem("Image1");
myComboBox.addItem("Image2");
myComboBox.addItem("Image3");
myComboboxListener = new Object ();
comboboxListener.change = function (eventObj){
var eventSource = eventObj.target;
var theSelectedItem = eventSource.selectedItem;
var theSelectedItemLabel = theSelectedItem.label;
gotoAndStop (5);
}
myComboBox.addEventListener("change", comboboxListener);
Please can someone explain to me what I’m doing wrong. Your time and help is much appreciated.