9 Replies Latest reply on Mar 19, 2008 8:14 AM by Newsgroup_User

    Is List Component useless?

    GerryIsHere Level 1
      Hi there!

      I populated a List Component.
      How can I trigger an action when selecting one item in the List?
      For example: open a mc to enter a corresponding value in a field...

      Many thanks in advance for your lessons!

      Best regards,
      Gerry
        • 1. Re: Is List Component useless?
          Level 7
          Gerry,

          The syntax is a bit different between ActionScript 2.0 and 3.0, but
          since you're posting to the AS2 group, I'll assume you're using AS2. If you
          open the Help panel and search "List class," you'll find a listing for the
          class entry that defines List objects (that is, the List component). The
          listing appears in the "Components Language Reference," which spells out all
          the properties, methods, and events of this class.

          You'll notice a List.change event, which shows sample code when you
          click on it. See if that gets you started, and write back if you have any
          trouble with it. :)


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: Is List Component useless?
            GerryIsHere Level 1
            Wow! Thanks for the tip Dave!
            It's quite a lot of knowledge to study...
            At my age, it will make my brain boiling! :-)

            Even if the question is answered, I don't close the topic because, for sure, I'll need some explanations...
            Thank you for your kind offer.

            Best,
            Gerry
            • 3. Re: Is List Component useless?
              Level 7
              Gerry,

              > Wow! Thanks for the tip Dave!
              > It's quite a lot of knowledge to study...
              > At my age, it will make my brain boiling! :-)

              Haha ... have fun with the boil! Most of what you'll find in the
              ActionScript 2.0 (or 3.0) Language Reference, or the Components Language
              Reference is organized around the classes that make up the objects available
              to ActionScript. Movie clips are defined by the MovieClip class, text
              fields by the TextField class, and so on. Under these class listings,
              properties represented characteristics of the object in question; methods
              are things the object can do; events are things the object can react to.

              Have fun with it, and do write back if you have questions.


              David Stiller
              Co-author, Foundation Flash CS3 for Designers
              http://tinyurl.com/2k29mj
              "Luck is the residue of good design."


              • 4. Re: Is List Component useless?
                GerryIsHere Level 1
                Thanks for the advices!
                I hope for the best and I'm prepared for the worst !!!

                Best,
                Gerry
                • 5. Re: Is List Component useless?
                  GerryIsHere Level 1
                  And... the worst happened!
                  My brain has vaporized...

                  Hello David, this is Gerry's soul speaking:

                  I can't even select Items in the List Component...
                  I see them displayed in the List but selection outputs an undefined which is a word I hate!
                  Look at the code and please tell me what's wrong.

                  Best,

                  Gerry

                  • 6. Re: Is List Component useless?
                    Level 7
                    Gerry,

                    > Look at the code and please tell me what's wrong.

                    Did you give your List instance the instance name LISTBUY? Your code
                    works just fine for me. ;)

                    You can reduce much of that code into a more compact format by
                    referencing the various properties strung together like this:

                    var onClickList:Object = new Object();
                    onClickList.change = function(evtobj:Object):Void {
                    trace(evtobj.target.selectedItem.label);
                    trace(evtobj.target.selectedItem.data);
                    };
                    LISTBUY.addEventListener("change", onClickList);

                    But your code certainly works just fine, as is, in a keyframe that
                    vertically aligns with a keyframe that contains a List instance with the
                    instance name LISTBUY.


                    David Stiller
                    Adobe Community Expert
                    Dev blog, http://www.quip.net/blog/
                    "Luck is the residue of good design."


                    • 7. Re: Is List Component useless?
                      GerryIsHere Level 1
                      Thanks for replying, David.
                      Answer is yes to all the requirements you wrote.

                      I think the problem is located elsewhere:
                      LISTBUY may not receive the full array it should.
                      i.e. I suspect it only receives the labels (which I can see) but not the corresponding data to these labels.

                      I work on this and in case of problem I'll come back to you.

                      Thanks again,
                      Best

                      Gerry
                      • 8. Re: Is List Component useless?
                        GerryIsHere Level 1
                        As I suspected, error was in populating the list...

                        David, I thank you for your help and, please, watch this very same forum as I post another different question related to this List Component problem.

                        Best,
                        Gerry
                        • 9. Re: Is List Component useless?
                          Level 7
                          Gerry,

                          > As I suspected, error was in populating the list...

                          Ah, the devil is in the details!

                          > David, I thank you for your help and, please, watch this
                          > very same forum as I post another different question

                          Sure, thing, Gerry. I'm often in these forums.


                          David Stiller
                          Contributor, How to Cheat in Flash CS3
                          http://tinyurl.com/2cp6na
                          "Luck is the residue of good design."