Analog flash clock tutorial

screenshot

In this tutorial we are going to create a flash analog clock that is going to cling at mouse over.  You can use this clock to add a nice effect on your websites. To do this work, the tutorial reader must have basic knowledge about Photoshop and Flash as this is a medium level tutorial.

First we must  design a clock in Photoshop.

Open Photoshop and make a new document at 115px – 115px size. Then draw a rectangle that is going to be the main background of the clock.

1

Give the clock a big stroke with some metal gradient.

2

Make a small circle in the center of the clock,  and also a small light shadow to give a nice effect to the clock.

3

Then draw the main digits of the clock, place them on initial positions.

4

At the end export a png from the Photoshop and save it.

5

We are done with Photoshop.

Next open Flash and make a new document with the next details, 260px – 200px size and 36 fps, like in the screenshot:

6

On the first layer import the clock png we saved from Photoshop. You can do that by clicking File-> Import-> Import to stage and then select the png from the specific location you saved. Align the clock to the center of the stage.

7

Click on the shape we just import and convert it to symbol : Modify-> Convert to Symbol ( F8),  and make the selections you see in the screenshot. We are going to make this a movie clip with a center regitration.

8

Double click the movie clip we created and make the next layer structure you see in the next screenshot. We are going to create 4 new layers, 3 for the clock needles and one for the main actions. As you can see the clock background layer and the 3 needles layer are build on 2 frames and the actions on one, that is to continuously loop the “animation”.

9

On the “seconds” layer draw the seconds needle and convert it to symbol, make it movie clip with regitration on center bottom. Position the movie clip needle with the center bottom regitration in the main center of the clock.

11

The same way build the minutes needle on “minutes” layer and make it a movie clip.

12

And the last needle is for the hours. Make sure you draw all the needles at different sizes.

13

After we draw all needles and made them movie clip we are going to atach some actions to every movie clip.

Select the seconds needle and then press F9 to open the actions panel (like in the screenshot). There write the following actions:

onClipEvent (enterFrame) {
setProperty(this, _rotation, _root.clock.seconds);
}

Make sure you are applying these actions to the movie clip and not to the layer.

14

Do the same way for the rest of the needles movie clips.

Minutes movie clip actions:

onClipEvent (enterFrame) {
setProperty(this, _rotation, _root.clock.minutes);
}

Hours movie clip actions:

onClipEvent (enterFrame) {
setProperty(this, _rotation, _root.clock.hours);
}

On the last layer, the actions layer insert the following actions:

time = new Date();
hours = time.getHours();
minutes = time.getMinutes();
seconds = time.getSeconds();
if (hours>12) {
hours = hours-12;
}
if (hours<1) {
hours = 12;
}
hours = hours*30+int(minutes/2);
minutes = minutes*6+int(seconds/10);
seconds = seconds*6;

15

Remember that we are now in the main clock movie clip. Next we will return to the scene1 of our document, the root.

Here we are going to create a new layer above the layer where the clock movie clip is. Apply the next actions here:

stop();
_root.circle_animation = 1;

16

Also we are going to add some actions to the main clock movie clip, so click and select the movie clip from the first layer and add the next code:

onClipEvent (construct)
{
friction = 8.000000E-001;
ratio = 1.000000E-001;
maxDistance = 2;
}
onClipEvent (load)
{
defaultX = _x;
defaultY = _y;
newXpos = defaultX;
newYpos = defaultY;
newXpos = 0;
newYpos = 0;
xDifference = 1;
yDifference = 1;
newX = 1;
newY = 1;
num = 5;
}
onClipEvent (enterFrame)
{
if (_root.circle_animation == 1)
{
if (this.hitTest(_root._xmouse, _root._ymouse, true))
{
xDifference = _root._xmouse – defaultX;
yDifference = _root._ymouse – defaultY;
newXpos = _root._xmouse – xDifference / maxDistance;
newYpos = _root._ymouse – yDifference / maxDistance;
}
else
{
newXpos = defaultX;
newYpos = defaultY;
} // end else if
newX = newX * friction + (newXpos – _x) * ratio;
newY = newY * friction + (newYpos – _y) * ratio;
setProperty(“”, _x, _x + newX);
setProperty(“”, _y, _y + newY);
setProperty(“”, _x, int(_x) + 1.000000E-001);
setProperty(“”, _y, int(_y) + 1.000000E-001);
} // end if
}

That it! We are now ready to test our analog clock. To do that hit Control+Enter and test you work.



http://www.braindumps.com/A00-211.htm
http://www.test-king.com/exams/C4090-450.htm
http://www.actualtests.com/exam-642-980.htm

14 Responses to “Analog flash clock tutorial”

  1. [...] This post was mentioned on Twitter by bkmacdaddy designs and hadi060, INDEZINER. INDEZINER said: RT @indeziner Analog flash clock tutorial | INDEZINER http://tinyurl.com/yf8m3te [...]

  2. Social comments and analytics for this post…

    This post was mentioned on Twitter by indeziner: RT @indeziner Analog flash clock tutorial | INDEZINER http://tinyurl.com/yf8m3te

  3. [...] post:  Analog flash clock tutorial | INDEZINER [...]

  4. [...] contamos con esto, una de las formas de practicar puede ser el tutorial publicado en Indeziner, donde nos muestran paso a paso cómo crear un reloj analógico en Photoshop y Flash [...]

  5. [...] contamos con esto, una de las formas de practicar puede ser el tutorial publicado en Indeziner, donde nos muestran paso a paso cómo crear un reloj analógico en Photoshop y Flash [...]

  6. [...] reloj con photoshop y para darle vida con Flash. Solo necesitas seguir los pasos de que nos deja Indeziner. Es una buena forma de practicar con [...]

  7. adesigns says:

    [...] y tiempo. Si contamos con esto, una de las formas de practicar puede ser el tutorial publicado en Indeziner, donde nos muestran paso a paso cómo crear un reloj analógico en Photoshop y Flash fácilmente. [...]

  8. Flash Clocks says:

    Great tutorial to teach how to create flash clocks with a good design, i build flash clocks myself with adobe flash, but i see some action script code that i might use in future projects of mine, so thanks for sharing a great tutorial and your original source code.

  9. [...] TUTORIAL  Cargando … [...]

Leave a Reply to The Best of 2009 in Flash Web Design - Flash Web Design and Design Photography | DesignOra