Using ActionScript
Objectives:
- Make a Mouse Trail
From Foundation Flash 5 by Bhangal, Farr, and Rey
|
Making a Mouse Trail
This is a cool effect. Take a look at this sample. This is similar to what you will make in this project. I decided not to make the shapes diminish in size when the mouse rolls over. As you will see, you can experiment with it once you learn the code.
- Start a new Flash movie.
- Change the background color to black.
- Click on View > Grid and also View > Snap to Grid.
- Create a new graphic symbol and name it sy.circle. Draw a small blue circle (less than 100 pixels). Center it at 0,0 using the info panel.
- Make a new movie clip and name it mc.circle. Rename the current layer of the movie clipcircle.
- Leave frame 1 blank. Add a keyframe (F6) in frame 2. Open the library and drag a copy of sy.circle to the stage. Position it at 0,0.
- Open the Effect panel and select alpha. Change the alpha setting to 70%.
- Insert a keyframe in frame 20. Open up the effect panel again, and select advanced. Slide the slider next to red to change it to 255.
- In the info panel, change the width and height to 1. Create a motion tween from frame 2 to 20.
- Open up the library and select sy.circle. Click on Options > Duplicate. Click on Symbol properties and convert the symbol into a button. Name it bu.circle.
- Insert a keyframe in the hit state and delete the circle from the up state. This will create an invisible button.
- Go into mc.circle and add a layer named actions and another layer named button.
- Click in the first frame of the button layer and drag an instance of the bu.circle symbol directly in the center. Use the info panel to make sure it's centered at 0,0.
- We only want the button to exist in frame 1, so remove all the extra frames of this of this layer. (You can do this by clicking on the end in frame 20 and dragging it all the way back to frame 1.)
- We are now going to add our actionscript. Select the button and open the Actionscript window. Use an On Mouse Event action and check Roll Over. Be sure to uncheck the release box. Next, add a Play action.
- Double-click in frame 1 of the actions layer and add a Stop action. Next, add a keyframe in frame 20 and add a Go to action. Uncheck the box next to Go to and Play.
- Drag an instance of the movieclip onto the main stage.
- Test the movie. You should see a blank screen until your mouse rolls over the shape. Then it will diminish.
- Now, using the grid, create a whole row of overlapping clips that completely covers left to right on your screen. Select all of them and hit F8. Make it a new movie clip named mc.circle.row.
- Drag instances of this new clip until the entire screen is covered with them.
- Test it out!
Assignment
Create your own customized version of the above. Be creative and make your own version of a mouse trail.
<< Back to Skyline |