Make Flash Animations, Video, Slideshows, Text Effects, Buttons & Menus. Designer Templates, 250 Effects, plus Components & Video Controls

简体中文 繁體中文 Français Español Italiano 日本 Polski Deutsch SWiSHzone.com
SWiSHzone.com Banner
You are here: Home > Community > Tutorials
Community
FREE TOOLS!
Laboratory
Community Overview
Movies
Components
Effects
Screencast Tutorials
> Tutorials
Official Blog
Forums
Other Forums
Request help
Search Tutorials

 All words
 Any words

 Similar words
 Exact words

Number of Results:
Monthly Newsletter
Get our monthly newsletter for all the latest news
competitions, tutorials and tips > Sign Up Now

SWiSH Max: Mouse Trailer for SWF4 Export
Creator: Brian Ayers
Website: http://www.swishzone.com
Submitted: Fri Oct 15 2004
Description:
Zip File: Download


SWiSHmax Mouse Trailer Tutorial

Mouse Trailer for SWF4 Export

Introduction

This tutorial will show how to create a mouse trailer that is compatible with SWF files exported to SWF4 format. There is a shorter, easier way to create this file using SWF5 export, but I thought I would present this method for maximum compatibility - not only that, the methods used in this tutorial have other capabilities aside from mouse trailers!

1. Start a new, blank file. Open the movie panel and give the movie a width of 400 and a height of 300. Set the background color as White and save this file as "mymousetrailer.swi"

1a. Insert an empty Sprite (Insert | Sprite), and name it "mousePosition" on the Sprite panel.

Creating the Mouse follower

2a. Use the Auto-Shape tool to draw 3 small Star shapes (different sizes and colors). Place them in close proximity to one another.

3a. In the Timeline Panel, Right-Click at Frame 1 on the row for one of the Star shapes. Select MOVE from the menu.

4a. Double-Click on the MOVE effect that was added to the Timeline to open the Move Settings window. Using the Motion tab, use the 'X scale' drop-down menu and select "Resize to scale" then type "10" into the field next to it (without quotes). Next, use the 'Color' drop-down menu and select "Fade to Color" then use the color selection drop-down menu off to the right to choose the color you to fade to. Press the Close button on the Move Settings window to save these changes.

5a. Right-Click at Frame 11 on the row for the Star shape (immediately following the MOVE effect). Select MOVE again from the menu.

6a. Double-Click on the second MOVE effect to open the settings window. Change the 'X scale' option to "Resize to 100%". Use the 'Color' drop-down menu and select "Fade to Color" and select the original color of the shape.

Note: The first MOVE effect will shrink the Star shape and change its color properties. The second MOVE effect is used to change the shapes properties back to their original settings.

7a. Next, you have two options ... You can either repeat Step #3a through Step #6a for each of the Star shapes (slightly changing the Scale in the first MOVE effect - and the Fade to Color for each Star), or you can hold down the CTRL key, click once on both MOVE effects - use the Edit menu and select 'Copy Effect', then Right-Click at Frame 1 on the row for each Star Shape, and select "Paste Effect". After pasting each set of MOVE effects, double-click on each one to change the settings (to scale each Star shape to a different size and fade to a different color).

8a. Hold down the CTRL key and click on each Star Shape in the Outline panel (this will highlight all of the Star shapes).

9a. Group all the Star shapes as a Sprite (Modify | Grouping | Group as Sprite).

10a. Name the Sprite "mouseFollower" on the Sprite panel, and make sure the option "Stop playing at end of Sprite" is NOT ticked.

Adding the Drag actions to the 'mousePosition' Sprite

1b. Select the sprite "mousePosition" in the Outline Panel.

2b. Open the Script panel and add an onLoad event to the Sprite (Add Script | Events | Frame | onLoad).

3b. Add a startDragLocked action to the onLoad event (Add Script | Mouse Dragging | startDragLocked).

The script for the "mousePosition" Sprite should appear similar to this:

Adding the Actions for the Mouse Follower

1c. Select the Sprite "mouseFollower" in the Outline Panel.

2c. Open the Script Panel and add an onEnterFrame event to the sprite (Add Script | Events | Frame | onEnterFrame).

3c. Add a Name=Expr statement to the onEnterFrame event (Add Script | Statements | Name=Expr). Enter "easing" in to the 'Name' field, and set the value to ".1" in the field below the Operator (leave the Operator set to "=(set value)").

Note: To create a different speed for the Mouse Follower - you can alter the easing value to anything between ".1" and ".99". Also note that the Framerate of your movie will effect the speed of the mouse follower.

4c. Add another Name=Expr statement, use the drop-down menu off to the right of the 'Name' field and select "_X" from the list. Change the Operator to "+=(add or plus)", and type the following in to the value field below the Operator (without quotes):
"(_parent.mousePosition._X - _X) * easing"

5c. Add another Name=Expr statement, select "_Y" from the drop-down menu next to the 'Name' field, change the Operator to "+=(add or plus)", and type the following in to the value field below the Operator (without quotes):
"(_parent.mousePosition._Y - _Y) * easing"

6c. For an added effect, add a final Name=Expr statement, select "_rotation" from the drop-down menu next to the 'Name field, change the Operator to "+=(add or plus)", and type in a value of '10' (ten). This will cause the follower to spin as it chases the cursor around the screen.

The script for the "mouseFollower" Sprite should appear similar to this:

Now, Go back to the Layout Panel ... Press the 'Play Movie' button, and watch what happens !

Summary:

The script added to the "mousePosition" sprite will tell that sprite to automatically begin dragging (locked to the mouse cursor) when the movie loads. The script for the "mouseFollower" sprite is executed on every frame (onEnterFrame). That script takes the current position of the "mousePosition" sprite, subtracts the position (X and Y) of the "mouseFollower" sprite, and multiplies that by the easing value. The easing value acts as friction - without the easing applied to the script, the Mouse Follower would simply be stuck to the position of the mouse cursor.



Search | Privacy policy | Contact us | Site Map | Copyright SWiSHzone.com Pty Ltd 1999-2010