Developing Webs logo
Google
Web DW-Main DW-Photoshop
Visit the message board for solutions or post a question Check out the Classes offered for free at Developing Webs Voice Chat submit a tutorial, resources, article, font for publication consideration and earn a one way link back to your site Get more specifics about the Developing Webs Voice chat room and its room members View the current news at Developing Webs alternative sites which are resources for your d3evelopment needs Join Developing Webs Chat Link to us on your web page to help support this resource! Check out Developing Webs At yahoo groups! Developing Webs Home Adobe Photoshop Tutorials Macromedia Flash Tutorials Jasc Paint Shop Pro Tutorials Adobe Illustrator Animation basics Some Basic PHP tutorials Perl Tutorials HTML Tutorials Cascading Style Sheets javascript Front Page Tutorials Macromedia Dream Weaver Tutorials dreamweaver Publishing your site, FTP, ChMod, Promotions
RSS Newsfeed
for your site
DW News
Calendar
DW Forum
Right click on button and copy shortcut

Add to My Yahoo!

Reminder
Remember to book mark this site!



Request a Tutorial

Event Handler Script for Mouse Events

  • You will need this movie to complete this tutorial

In this tutorial you will create 8 different mouse event handlers to activate a movie clip. The event handlers will be treated separately here, although they can work together on the same button in combination.

 

Event What mouse action gets it to work.
press Reacts when the mouse button is pressed when the cursor is positioned over the button.
release Reacts when the mouse button is pressed and released when the cursor is over the button.
releaseOutside Reacts when a button as been pressed followed by a drag off the button and release off the button
rollOver Reacts on a simple rollover without a click.
rollOut Reacts when the mouse cursor leaves a button.
dragOver Reacts when the mouse button is pressed on the button and then dragged off the button hot spot, followed by dragged ba ck onto the host spot.
dragOut Reacts when the mouse button is pressed on the button and then dragged off the button hot spot.
keyPress Reacts when a specified key on your keyboard is pressed. This is case sensitive.

1. Open your movie. Your movie has 1 layer, 1 frame in the one scene. There are 8 buttons on the left, each grouped with a name of a mouse event. The action we will try to achieve is to get the earth to revolve around the sun. The earth is a movie clip with a stop in the first frame. The earth revolves around the sun if it plays. The earth is a named instance on the stage. As a Movie clip we can name it in the properties inspector when it is highlighted.  The earth here is named "earth"

2. Click on the first button in front of the press label, to highlight it and open the Actions panel. The actions panel should have a tital bar that says Actions - button. The Jump menu should show  Actions for Symbol 1 copy 7.

The actions panel should show 2 columns. The left is a list of actions. From the left:

Click Objects=> Movie=> Movie Clip=> Methods=> Play. 

Double click Play to transfer the action to the right. This action is associated with directing a movie clip to play. Notice a default play script for the mouse event handler appears in the script box on the right.


3. Click in the object box in the parameters area(1). Here you will point to the location of the earth movie clip.  Click the target below the object box to select a taget(2). the Insert Target Path dialogue box appears. Select notation as dots(3). Select mode as absolute(4.) to keep it simple. click on the earth above to select the named instance earth(5). Click ok.

4. Now that the path to the movie clip is set, and action is set to play, you will need to set your event handler to press, and remove release as the handler mouse action. Click on the line that says on (release) {. The options for the event handler for the mouse appear. Uncheck release, and check press.

 

5. Click on the second button by the label release. Set up the script for this button in an identical fashion, substituting the release action for the event handler.

6, Do the same for each of the following buttons. Set the event handler up for the appropriate event action for each button.  When you get to the key press, set the key stroke up as the letter e. Save your movie and publish. You should be successful in viewing the different actions of each button.



"Building The Web Into a Nicer Place -- One Site At A Time"
Developing Webs Group Copyright © 2001-2026 All Rights Reserved
Privacy and Legal