3 Replies Latest reply on May 23, 2006 7:13 AM by Rothrock

    Last plea for help on a SIMPLE problem !

    Level 7
      These combo jumbo boxes are hurting my head.
      I've read the help eight times - maybe it's me but I can't help feeling
      that I've written better help for my babysitter. If you already
      understand then the help
      is great - if you don't then it is utterly inpenetrable.

      C'mon guys. Help me out and show me some code. Lead me by the nose.
      I've been directed to here and to there to learn this and that but that's
      not what I'm here for tonight.
      I need a simple solution to a simple thing given away out of the
      kindness of your hearts.
      To stop me tearing out any more hair.
      var.head = bald and hurting
      var.frustration = boiling point

      I have a form with lots of input fields and a couple of combo boxes.
      One of the combos is a list of countries. All I need is this:

      If a user selects any country other than "Virgin Islands" then a few of the
      (now irrelevant) input fields on the form go to 50% alpha - or become
      The input fields are named "info1, info2" etc.,

      I know this can't be hard to do and I've tried to work it out through the help,
      through tutorials all over the net and by shouting very loudly at this Mac
      in front of me. But nothing works so far. I've hit it twice and asked
      you lot three times.
      No joy so far.

      I'm about to turn to drink in the hope that this will either provide
      divine inspiration or
      allow me not to care and to go cruising the porn instead.

      Save me from the dark side.

        • 1. Re: Last plea for help on a SIMPLE problem !
          Rothrock Level 5
          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"){
          } else {

          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 !

            I have to agree with you about the Flash help files. They make me think of the old adage - never have a developer write their own manual.

            • 3. Re: Last plea for help on a SIMPLE problem !
              Rothrock Level 5
              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.