flash actionscript:
I have a comboBox problem. Here is my code: // myComboBox setup myComboBox1.addItem("Austria", "Austria"); // myComboBox Playhead // whe an intem is selected listenerObject.change = function() { var my_item = myComboBox1.selectedItem; trace(my_item.label); trace(my_item.data); // go to the specified frame gotoAndPlay(my_item.data); } The problem is that this is not working. All I want to do is make the comboBox listen to the users input and and go to the selected frame of that movie. Example: If user selects "xyz" from the comboBox the user should be taken to the frame that "xyz" relates to. "xyz" = frame "_xyz". I can't seem to figure this one out with AS 1.0. Everyone seems to only know how to do this in AS 2.0 or the only references I can find (such as tutorials and books) use buttons. I'm not using buttons...so that creates a problem. Any help would be much appriciated. :)
try something like (where cbox is the instance name of the combobox component ) - aLabels = ["Select","Ties","Tops","Jeans","Belts"]; aData = ["","tie","top","jean","belt"]; iList = new Array(); for (var ii=0; ii<aLabels.length; ii++) { myItem = new Object(); myItem.label = aLabels[ ii ]; myItem.data = aData[ ii ]; iList[ ii ] = myItem; } cbox.setDataProvider(iList); cbox.setChangeHandler("cb1"); cb1 = function(combo){ theLabel = combo.getSelectedItem().label; theData = combo.getSelectedItem().data; trace(theLabel); trace(theData); _root.gotoAndStop(theData); }; hth
Don't see what you're looking for? Try a search.
|