This content has been marked as final.
Show 3 replies
-
1. Re: Last plea for help on a SIMPLE problem !
Rothrock May 22, 2006 5:50 PM (in response to Newsgroup_User)What have are you trying? Show us your code. Which version of Flash are you using?
In Flash 7. Help Menu –> Using Components –> Components Dictionary –> ComboBox.
This will give you a list of everything you can do with a combo box. There is nothing else you can do. So if it ain't there you can't do it with a combo box. Have you read every single entry? You don't have to go too far – the one you want is called ComboBox.change. This is something that happens when there is a change to the ComboBox – like when somebody selects a country.
Personally I would use usage 2 which has this code:
form = new Object();
form.change = function(eventObj){
trace("Value changed to " + eventObj.target.value);
}
myCombo.addEventListener("change", form);
Of course you would change the name of myCombo to whatever the name of your comboBox was.
After that you will have to be a bit on your own. I've never used a comboBox before. But I'm guessing inside that form.change function you would replace the trace with something like:
if(eventObj.target.value != "Virgin Islands"){
somefield1.text="";
someField1._alpha=50;
someField1.enabled=false;
} else {
someField1._alpha=100;
someField1.enabled=true;
}
The second part of the if condition is in the event that they go back later and select Virgin Islands after first selecting something else.
As I said before I've never used a combobox but this seems pretty straight forward. If I was going to be doing this myself, I would probably start with a brand new file and try to make it work just in a basic way before I tried to integrate it with an existing project. -
2. Re: Last plea for help on a SIMPLE problem !
truly_great May 22, 2006 7:40 PM (in response to Newsgroup_User) -
3. Re: Last plea for help on a SIMPLE problem !
Rothrock May 23, 2006 7:13 AM (in response to Newsgroup_User)Actually I don't agree at all. Since Flash 7 the help files are actually quite rockin'. It is the search function that is not so good. You just have to know a bit about how it is organized.
Everything is by class or component. So anytime you start using a new one read the entry for that class or component and you will see everything that can be done with it. And almost every entry has a sample of code.
Keep in mind there are three main types of entries: properties, methods, and events. So if you are looking to do a specific type of thing look for what you need.
Properties are just that: things about the class or an instance of that class. Familiar properties are things like MovieClip._x (the x position), MovieClip._alpha (the transparency), Array.length (how many elements in an array), and so on. Some properties are read-only other can be set/changed by your code. They often (but not always) are proceeded by an underscore and otherwise they are often just nouns.
Methods are also just what they say they are: they are ways of getting something done. Some familiar methods are MovieClip.loadMovie(), MovieClip.swapDepths(), or Array.sort(); Methods are often named with a verb and sometimes a noun is also in there – this is to emphasis there active nature. They also have the parenthesis after them because they often take arguments.
Finally events, which again are aptly named. Events occur when something happens. Popular events might be MovieClip.onRollOver, MovieClipLoader.onLoad, or TextField.onChange. They are usually named with a preposition (especially "on") and a verb. There is an old style of methods that you will often see as on(someEvent). That style needs to be placed on the instance itself, but I prefer to use the newer ClassName.onSomeEvent style and put it on a frame.
So here was my thought process for answering this question, and remember I've never used a combobox before.
Go to the entry for combo box.
I want to do something when something is selected.
Hmmm. I need an event. Logical choices would be onSelect, onChoice, onClick, etc. I don't see those, but I see similar words. I'm away from my help file at the moment, but I recall there were some that had "select" and "change" in them. Start there.
Read those entries. Paying special attention to the code at the bottom and also seeing if they link to any other entries that might show alternate ways.
Finally I settled on change. It turns out that it isn't quite a straight forward event, but it isn't too complex to understand. But they give you the code.
In the end, most people psych themselves out and try and make it more complex than it has to be.