First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: Dan Ludwig | Website: http://www.danludwig.com

The script runs again when you release and press the scroll button again. This time the "if" argument can't be evaluated to a null, since we have a definite value (5000) stored in the up_last_click variable. Lets assume you pressed the button exactly one quarter (1/4) second after the first press, and lets step through this script again:

up_first_click = getTimer( );

Now the up_first_click variable is updated to a new value by the "getTImer" action. Since one quarter second translates to 250 ms, up_first_click's new value will be 5250 (5000 + 250 = 5250). With that done, we move to the "if" condition, and fill in our numeric values for the up_first_click and up_last_click variables. 5250 - 5000 = 250 ms. Using this inequality expression, Mick has set the double-click threshold to 350 ms. As long as the pause between button presses is equal to or less than 350 ms, as it is in our example, the "if" argument returns "true" and its embedded action is executed. If the pause between cicks is longer than 350 ms, the continuous feedback buttons are triggered instead.

The embedded action, "scroll_shape._y = scroll_shape.logic.top;" immediately sets the _y position of scroll_shape to its uppermost limit, top. This is what creates the jump effect. Since our example "if" argument returns "true," the continuous feedback action embedded within the "else" clause is skipped. (A "true" value for the "if" statement voids the "else" clause below it.) Either way though, the action loop in logic is always triggered on (press) because the "gotoAndPlay("scroll_logic")" action isn't embedded within either the "if" or the "else." Conversely, logic is always stopped on (release).

The script for the bottom button is again structured very similarly to the top, however the double click variables are named down_first_click and down_last_click. Also the jump action embedded within the "if" statement sets scroll_shape._y to bottom, not top. The code in the source FLA is extensively commented, but feel free to remove the comments ("//blah blah blah") if it makes the code easier to understand for you :^)

» Level Intermediate

Added: 2000-12-08
Rating: 8 Votes: 94
(10 being the highest)
» Author
Me Like Flash 5. Flash 4 good. Flash 5 better.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.