Internet Commerce

Partners & Affiliates

Developer Channel


Featured Flash FLA
Gallery Downloads 11401 Flash Movies | 5 New Flash Movies Added
What's New | Top 100

Featured FLA

»  Author: Nick Kouvaris
»  Title: Znax
»  Description: Znax is a board game. Click 4 tiles of the same color and form squares as big as you can. You will erase all the tiles inside the square and collect points. Get maximum score if you make a square with game edges.
»  More by: Nick Kouvaris


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 4941 Flash Sites | 1 New Flash Links
What's New | Top 100 Flash Site

Featured Site

»  Author Agence WOP Digital Agency
»  Title: Electricdrum
»  Description: French WOP Agency, 3D websites, Flash (Papervision, Away 3D), event or institutional projects. The agency operates on all digital projects: consulting, design, graphic design, development, online communication. The WOP agency follows you on the implementation of original, creative and optimized digital projects.


Random Links | Add your own Flash Related Links
Flash Tutorials 1481 Tutorials 7 New Tutorials Added!
What's New | Top100

» How To Make A Simple Animation Using Christmas Clips
» Simple Step by step flash game tutorial Spot the diffrence
» How To Make A Moving Text Slide
» Create Flash Banner With Text Float Effect
» How To Make Zoo Photos Slideshow
» How To Make A Dolphin Photos Slideshow
» How To Make A Fathers Day Slideshow
» How To Make A Transparent Background of Your Flash File
» Create Flash Banner With Text Disco Light Effect Today we will introduce you a Text Disco Light eff
» Unknown Tag: Title10
Random Tutorial | Add Site


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Interactivity

Categories Preloader with Dial Display
Author: Alan Wisternoff | Website: http://www.buffoonbrothers.com |

 
Page 5
«prev 1 2 3 4 5 6 7 next»

Step Four: The Revolving Movieclip

The movieclip I wanted to follow the needle is actually a dynamic textbox inside a movieClip. On the stage use the text tool to create a textbox. In the options choose dynamic, single line, dont check any of the checkboxes and embed any fonts you require. In the variable box add this:

_root.v

Then select this textbox and convert it to a movieClip. It does not need an instance name. We will use an onClipEvent action to position this movieClip at the correct place. Now comes the maths!

We need to give the movieclip the coordinates (x,y) at the end of the needle. Seeing we have the angle (w) and the length of the needle (in my case 210 pixels) we can work out everything else with sin/cos. Use the grid to measure the length of your own needle. The bottom right has the formulae if you are unfamiliar with these trigometric functions. One thing we need to do now is convert our angle (w) from degrees to radians, which we must use as the angle in these formulae. Back on the main timeline with the other variables add this:

radian = Math.PI/180*(w);

This is just a formula to do the conversion. Select the textbox movieclip and add this code:

onClipEvent (enterFrame) {
 this._x = 210*(Math.sin(_root.radian))+_root.needle._x;
 this._y = 210*(Math.cos(_root.radian))+_root.needle._y;
}

Using the top line of code which generates the x coordinate as an example I will explain the maths. If the sine of an angle is the opposite over the hypotenuse that would mean

sine(radian) = opposite/210

therefore the opposite (x coordinate) = 210 * sin(radian), which you can see is what we have in the code. At the end we have added

+ _root.needle._x;

as we are working out our angles from the needles registration point. So as the angle w increases, our x,y coordinates will be constantly updated and the movieclip will track around the needles outer edge. If you test the movie now you will see everything working apart from one small detail. The movie clip is tracking in a counerclockwise direction, opposite to the needle!

«prev 1 2 3 4 5 6 7 next»

» Level Intermediate

Added: : 2003-05-19
Rating: 7.02 Votes: 27
Hits: 3235
» Author
Cyclist, Snowboarder, Flash Designer Extrordinaire.
» Download
Download the files used in this tutorial.
Download (52 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments