3 Replies Latest reply on Jul 13, 2006 4:01 PM by Jim_Esteban

    Multiple Hit Button Without Using The Timeline

      Hello. I'm pretty much a beginner when it comes to flash. So, I assume there's been a post about this topic already. But, does anyone know how to script a code that lets you hit a button multiple times to execute an action without using the time line. For example. on http://www.group94.com/ website under menu / projects they use arrows to move the text on the y axis. Every time you click down on the text, it shifts upwards. I assume this a multiple hit action since the text shifts to? Can anyone help. Thanks.

        • 1. Re: Multiple Hit Button Without Using The Timeline
          blemmo Level 1
          Well, every action assigned to a button is executed multiple times when the button is hit repeatedly. I assume you mean kind of different actions? This could be done with a counter variable and a switch statement, like this:
          var count:Number = 0;
          button.onRelease = function(){
          case 1:
          // actions for 1st click
          case 2:
          // ...
          case 5:
          count = 0; // reset counter

          However, in the website you linked, I suppose they don't do it this way, but with a more dynamic approach: Load the data (links and linktext) from a xml or text file, then build an array out of the contents and display the first entries. When the button is clicked, the first entry goes off, the next entry comes in. When the end of the array is reached, go back to entry 1 (not sure they do that, I didn't try it so far). So you would need a function, like displayNext(), that executes on every click and checks for itself which is the next entry to display and goes through the array this way.
          That's just a guess how they did it, or rather, how I would do it. ;)

          • 2. Re: Multiple Hit Button Without Using The Timeline
            gkatz78 Level 1
            Thanks Blemmo. I'll give it a try. I'm very appreciative of your response.
            • 3. Re: Multiple Hit Button Without Using The Timeline
              Jim_Esteban Level 1
              I looked at the site http://www.group94.com/ website under menu / projects and it looks like a rather unique scrolling function. I doubt that it's just a simple matter of moving the text up and down. For all we now there could be an entire class written just to support the movement of text in that window. Obviously they are trying to impress us with their unique abilities. Personally I find the movement slow and cumbersome and I would rather avoid the entire site.