Digital Clock Movie Clip - Actions

HomeTutorialsForumWebwasp MembersTemplatesMatesFoodContact

 


Flash Tutorials

   

Free Flash Tutorial - Digital Clock

 

Free Flash Tutorial


Page 3     <<   Previous    Intro   1   2   3   4    Next   >>       >>   Webwasp Mates

 

Step Three: Creating the Clock Movie Clip - Actions

You should still be in the Time MC. If you are not open the Library and find the symbol and select Edit from the drop down menu.

  1. Re-name layer 1 to: Text Box
  2. On frame 2 right click (Mac: Ctrl click) and select: Insert Frame


    Timeline with two frames.

  3. Create a new layer by clicking on the Insert Layer button:
  4. Rename this new Layer: Actions


    New Actions Layer.

  5. In frame 1 of this new Layer place the following ActionScript:



    // Gets the date and time info from the local computers clock
    myDate =
    new Date();

    //Gets the hours and adds a zero if the number is a single digit like this: 01
    var hours = myDate.getHours()>9 ? myDate.getHours() : "0"+myDate.getHours();

    //Gets the minutes and adds a zero if the number is a single digit like this: 01
    var minutes = myDate.getMinutes()>9 ? myDate.getMinutes() : "0"+myDate.getMinutes();

    //Gets the seconds and adds a zero if the number is a single digit like this: 01
    var seconds = myDate.getSeconds()>9 ? myDate.getSeconds() : "0"+myDate.getSeconds();

    // Displays the time like this: 00 . 01 : 01
    myTime = (hours + " . " + minutes + " : " + seconds);

  6. In Frame 2 of the Actions Layers right click and select: Insert Blank Keyframe
  7. Place the following ActionScript in frame 2 of the Actions layer:

    gotoAndPlay(1);
  8. Note: Your Timeline should look like this:


    Timeline.

  9. The Movie Clip is now complete so return to the Main Stage by clicking the Scene 1 Tab:

    Note: If you cannot see the Scene 1 Tab open the Edit bar: Window > Toolbars > Edit bar

         

Page 3     <<   Previous    Intro   1   2   3   4    Next   >>       >>   Webwasp Mates


Webwasp Community: Webwasp Mates & Dates

Why not try out webwasp's new community. Meet new people, find friends in your area: Webwasp Mates & Dates

Phil Schulz's Facebook profile
Webwasp is Phil Schulz's baby. You are welcome to contact me or become my Facebook friend: Click here

 Top of Page Home Food Mates Members Tutorials Forum Buy Templates Contact Us 
 All material on this site is protected under international copyright © law. DO NOT reproduce any material from this site without written permission. Please ask as permission is often granted.