iEntry 10th Anniversary Photoshop Flash
Digital Watch (Flash beginner tutorial) page 3 of 3
| | |

Digital Watch (Flash beginner tutorial) page 3 of 3

RSS feeds

Website

More tutorials?

Partner sites

Digital Watch (page 3/3)

Written by Mike | Posted on March 26th, 2007
Bookmark this tutorial using any bookmark manager!
 
Digital Watch (Flash beginner tutorial) - step 7
Change the name of the current layer to "watch". Create a new layer and set its name to "actions".
Digital Watch (Flash beginner tutorial) - step 8
Right-click the first frame on this new layer and go to Actions. Paste the code below and hit Ctrl+Enter to see your digital watch in action.
stop();

var days = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");

var months = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

watch.onEnterFrame = function() {
  var date = new Date();
  this.date = days[date.getDay()]+", "+date.getDate()+" of "+months[date.getMonth()]+" of "+date.getFullYear();

  this.hour = date.getHours();
  this.minute = date.getMinutes();
  this.second = date.getSeconds();
  if (this.second<10) {
  this.second = "0"+this.second;
  }
  if (this.minute<10) {
    this.minute = "0"+this.minute;
  }
  if (this.hour<10) {
    this.hour = "0"+this.hour;
  }
};

‹‹ Page 2 This is page 3 of 3  

Hot!

New! Submit your tutorials to our tutorial directory

Navigation

Browse tutorial

Categories

Newest tutorials

Tutorial directory

Newsletter



OKTutorials.com is an iEntry Network® publication - 1998-2010 All Rights Reserved Privacy Policy and Legal
All tutorials feed Contact us OkTutorials.com home Tutorial directory Submit a tutorial