View Full Version : jump to another frame through combo box
Hi all..
I need ur help....
I want to jump to another frame after i choose certain name in combo box list, so what script i can add below.
many thanks
myComboBoxListener = new Object();
myComboBoxListener.change = function(eventObj)
{
var eventSource = eventObj.target;
var theSelectedItem = eventSource.selectedItem;
var theSelectedItemLabel = theSelectedItem.label;
}
myComboBox.addEventListener ("change", myComboBoxListener);
madgett
06-04-2005, 08:06 PM
Use the selectedIndex property of the combobox class:
myComboBoxListener = new Object();
myComboBoxListener.change = function(eventObj) {
var eventSource = eventObj.target;
var theSelectedItem = eventSource.selectedItem;
var theSelectedItemLabel = theSelectedItem.label;
// Go to frame based on selectedIndex, or something similar
_root.gotoAndPlay(eventObj.target.selectedIndex);
};
myComboBox.addEventListener("change", myComboBoxListener);
great, but actually I need like this :
in the combo box I have list : red, black, green
when I choose red , it bring me to certain frame, for example frame 10,
if I choose black , it bring me to frame 11,
if I choose green , it bring me to frame 12
so, what part of the script I have to change to make it
many thanks
madgett
06-05-2005, 07:19 PM
Just check the label and then use conditional logic to send which ever way:
myComboBoxListener = new Object();
myComboBoxListener.change = function(eventObj) {
var eventSource = eventObj.target;
var theSelectedItem = eventSource.selectedItem;
var theSelectedItemLabel = theSelectedItem.label;
// Go to frame based on selectedIndex, or something similar
if (theSelectedItemLabel == "red") {
_root.gotoAndPlay(10);
} else if (theSelectedItemLabel == "black") {
_root.gotoAndPlay(11);
}
// etc...
};
myComboBox.addEventListener("change", myComboBoxListener);
many thanks madgett , excellent......
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.