• home
  • forum
  • my
  • kt
  • download
  • Making a simple digital clock in Flash

    Author: 2007-06-06 15:48:38 From:

    In this Macromedia Flash tutorial you will see how to make and program a simple digital clock in actionscript.

    1.
    Start by creating a text on the stage and type in 00:00:00 just for the visual.

    Photoshop Tutorial thumb picture


    2.
    Now in the properties panel make the text dynamic and name it time1 as shown in the image below.

    Photoshop Tutorial thumb picture


    3.
    Right click and convert it to a movie clip.

    click the new movie clip and go to the action script panel.

    4.
    Now we are ready to make the code for our digital clock.

    This is acturlly pretty straight forward, eventhough it seems confusing.

    onClipEvent (enterFrame) {
    data = new Date();

    time1.text = data.getHours() + ":" + data.getMinutes() + ":" + data.getSeconds();
    }

    I will break the code up into pieces.

    onClipEvent (enterFrame) {
    code in here.
    }

    this is the container of the code, this will update the code so we get the current time updated.

    data = new Date();

    here we declare an object to be of the type date

    time1.text = data.getHours() + ":" + data.getMinutes() + ":" + data.getSeconds();

    time1 is our text from before, and we set its text to be first hour then a : then minut then : seconds

    And we are done.

    Now as we converted our timer to a movie clip we can easily apply a small animation to it.

    5.
    So I went to the filters panel and gave it a blur filter and animated it in the timeline.

    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      3D (20)
      Math Physics (14)
      3rd Party (5)
      Navigation (60)
      Actionscripting (26)
      Optimization (16)
      Animation (32)
      Projector (9)
      Audio (46)
      Special Effects (112)
      Backend (25)
      Text Effects (65)
      Drawing (18)
      Tips and Techniques (41)
      Dynamic Content (25)
      Tricks (6)
      Games (66)
      Utilities (19)
      Getting Started (71)
      Video (10)
      Interactivity (21)
      Web Design (22)

    New

    Hot