First time here? First time here? Newsletter Signup Newsletter
651326 Members and growing! | Flash Jobs
Search tutorials
Author: Gareth Gibson

Harnessing clip events to capture and distinguish between mouse clicks is a clever way of making dynamic buttons. Just like you embed on release or press code etc. on orthodox buttons, you can use the clip event handlers for mouse interactions (in unison with collision detection) to create dynamic buttons and interactivity using movie clip symbols. In this tutorial I will show you how clip events for mouseUp and mouseDown can be used to start and stop a timer and launch an action as a result of the length of time the timer runs for. To demonstrate this, I will use our trusty little friend the penguin once again.

There are two clipEvents that you can use in association with clicking your mouse, mouseDown, and mouseUp. These are fairly self explanatory, and work in much the same way as KeyUp and KeyDown.

If you use the mouseUp and mouseDown events as they are, there is now way of telling what you clicked on, all the instances with this clipEvent instruction will respond to any mouse click. To simulate a button, you need to perform a collision detection to see if your movie clip and the users mouse are at the same global position.

In this demonstration I will show how a timer can be started with the mouseDown event and stopped with the mouseUp event.

The idea behind my demonstration is that the longer you hold your mouse down, the higher our little friend the penguin is going to jump (he is a world champion vertical jumping penguin). As we all know, penguins are very obedient, and often can be found doing vertical jumps on request.

When we press the mouse down, a clipevent checks to see if we have clicked on the penguin or not (using the hittest method), and if we have, it starts the timer. The clip event we will use is the MouseDown event which tracks all clicks down of the mouse.

» Level Intermediate

Added: 2001-10-26
Rating: 7.53 Votes: 45
(10 being the highest)
» Author
No details available.
» 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.