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 Tools to help you create your site Free and shareware fonts to download Photographs to use in your projects Shop for your site needs Free Online classes REcommend this site to others Log in or edit your information when logged in Developingwebs Log Out Change My Account details and preferences
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

Scripting Smooth Rotations

Download the FLA to this file =>

Smooth rotations can be achieved by scripting with a swf movie that is quite small compared to a tween. Follow this tutorial to learn how to Set variables and increase and decrease the variable value, as well as using the if...else statement.

 

1. Create a new movie.

2. Draw an oval on your stage. Convert it to a symbol by clicking insert=> convert to symbol. Select Movie clip for behavior and call it myoval.

3. Name the instance Oval on the instance panel.

4. Click in frame 5 and hit F5 to increase the keyframe out to frame 5.

5. Insert a new layer.

6. Insert a keyframe on Frame 1, layer 2

7. Naming your variable.

  • Open your actions panel.
  • Click the + symbol => actions => var
  • Name your variable count = 0

7. Setting up your clockwise loop.

  • Insert a single keyframe on frame 3.
  • Click the + => actions => Set Variable.
    • Type count in the box for variable
    • Set the value to count+10 to increase the value of count by 10 each time this frame is played.
    • Check the box for expression under value.
  • Click the + => actions => IF to set the condition for the count loop.
    • Type in count>=370  (370 is 10 more degrees than a full circle.)
  • Click go to and play and set frame number to 4.
  • Click + => actions => else.
  • Click + => actions => Set Variable
    • Type in the path for the clip: _root.oval
    • Add the action: ._rotation
    • Set the value of rotation: = count
    • Check Expression
    • Resulting line reads _root.oval._rotation=count
  • Click + => basic actions => goto
    • Select frame number 2

Result of actionscripting on frame 3:

Setting up your counterclockwise loop.

  • Insert a single keyframe on frame 5.
  • Click the + => actions => Set Variable.
    • Type count in the box for variable
    • Set the value to count-10 to decrease the value of count by 10 each time this frame is played.
    • Check the box for expression under value.
  • Click the + => actions => IF to set the condition for the count loop.
    • Type in count<= -10  (-10 is 10 more degrees than a full circle.)
  • Click + => basic actions =>goto and set frame number to 4.
  • Click + => actions => else.
  • Click + => actions => Set Variable
    • Type in the path for the clip: _root.oval
    • Add the action: ._rotation
    • Set the value of rotation: = count
    • Check Expression
    • Resulting line reads _root.oval._rotation=count
  • Click + => basic actions => goto
    • Select frame number 2

Result of action scripting on frame 3:

 

You can make faster rotations by increasing the increment for count. You can slwo it down by decreasing the increment for count.

 

It's That EASY!

 



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