4 Replies Latest reply on Sep 18, 2011 4:38 PM by ozDiGennaro

    Capturing the number of Button Clicks

    rampally

      Hello,

       

      Was wondering if there was a way to capture the number of times and their order a user clicks on a button?

      Any pointers or suggestions is highly appreciated.

       

      Thanks

        • 1. Re: Capturing the number of Button Clicks
          rampally Level 1

          Can some one shed some light on this?

          • 2. Re: Capturing the number of Button Clicks
            GordonSmith Level 4

            To count clicks, you would just write a handler for the 'click' event and increment a counter.

             

            I don't know what you mean by capturing the order in which the user clicks a single button. Are you talking about capturing the order in which she clicks on various buttons? In that case, you could maintain an Array in which each element was a reference to a Button that was clicked. Again, you would use a 'click' handler on each Button to add an element to the Array. If you have many such Buttons that need such a click handler, then write a Buton subclass, either in AS or in MXML, to do this.

             

            Gordon Smith

            Adobe Flex SDK Team

            1 person found this helpful
            • 3. Re: Capturing the number of Button Clicks
              ozDiGennaro Level 1

              If I wanted to know the exact order of clicks, I would use an array of click events for each button.  Each entry in the array would have information like: event.type and the time of the event.  Use this method to get the time in milliseconds.

               

                  import mx.utils.*;
                  import flash.utils.*;

               

                      public static function getNowMS (): int {
                          var date:Date = new Date(); // default is now
                          var ms:int = date.milliseconds + date.seconds * 1000 + date.minutes * 1000 * 60 + date.hours * 1000 * 60 * 60;
                          return ms;
                      }

              1 person found this helpful
              • 4. Re: Capturing the number of Button Clicks
                ozDiGennaro Level 1

                Do you still need an answer to this?  Was my previous response too cryptic?

                Oz