Displaying The Date And Time
I have been trying to make a clock that displays the date and time. This is a great tutorial. http://www.flashkit.com/tutorials/Ac...22/index.shtml
Althought I can't get it to work. I can't reach the author to get the answer. This is the error message that displays in the actionscript output screen. when you run the movie. It has something to do with the a.m. or p.m. variabe text box. This message repeats itsself in the output and fills the screen with the same message until I stop the movie.
"Target not found: Target="amp" Base="_level0.instance1"
---------------------------------------------------
Here is the actionscript. Thanks in advance.
// ® Copyright 2001 ®RJH2001
// below is what 'creates' the dynamic timing mechanisms
mydate = new Date();
days = mydate.getDay();
month = mydate.getMonth();
months = mydate.getMonth();
day = mydate.getDate();
year = mydate.getFullYear();
hr = mydate.getHours();
min = mydate.getMinutes();
sec = mydate.getSeconds();
amp = mydate.getHours();
//
// below is what sets the am-pm 0-24 to display Am & Pm
if (amp eq "0" or amp eq "1" or amp eq "2" or amp eq "3" or amp eq "4" or amp eq "5" or amp eq "6" or amp eq "7" or amp eq "8" or amp eq "9" or amp eq "10" or amp eq "11") {
tellTarget ("amp") {
gotoAndStop (1);
}
}
if (amp eq "12" or amp eq "13" or amp eq "14" or amp eq "15" or amp eq "16" or amp eq "17" or amp eq "18" or amp eq "19" or amp eq "20" or amp eq "21" or amp eq "22" or amp eq "23") {
tellTarget ("amp") {
gotoAndStop (2);
}
}
//
// below is what sets the days 0-6 to display Sunday thru Saturday
if (days == "0") {
days = "Sunday";
}
if (days == 1) {
days = "Monday";
}
if (days == 2) {
days = "Tuesday";
}
if (days == 3) {
days = "Wednesday";
}
if (days == 4) {
days = "Thursday";
}
if (days == 5) {
days = "Friday";
}
if (days == 6) {y
days = "Saturday";
}
//
// below is what sets the months 0-11 to display January thru December
if (month == 0) {
month = "JANUARY";
}
if (month == 1) {
month = "FEBUARY";
}
if (month == 2) {
month = "MARCH";
}
if (month == 3) {
month = "APRIL";
}
if (month == 4) {
month = "MAY";
}
if (month == 5) {
month = "JUNE";
}
if (month == 6) {
month = "JULY";
}
if (month == 7) {
month = "AUGUST";
}
if (month == 8) {
month = "SEPTEMBER";
}
if (month == 9) {
month = "OCTOBER";
}
if (month == 10) {
month = "NOVEMBER";
}
if (month == 11) {
month = "DECEMBER";
}
//
// below is what sets the minutes 1 thru 9 to display 01 thru 09
if (length(min) == 1) {
min = "0" + mydate.getMinutes();
}
if (length(sec) == 1) {
sec = "0" + mydate.getSeconds();
}
//
// below is what sets the hours 0 and 13-23 to display 1-12
if (hr == 0) {
hr = "12";
}
if (hr == 13) {
hr = "1";
}
if (hr == 14) {
hr = "2";
}
if (hr == 15) {
hr = "3";
}
if (hr == 16) {
hr = "4";
}
if (hr == 17) {
hr = "5";
}
if (hr == 18) {
hr = "6";
}
if (hr == 19) {
hr = "7";
}
if (hr == 20) {
hr = "8";
}
if (hr == 21) {
hr = "9";
}
if (hr == 22) {
hr = "10";
}
if (hr == 23) {
hr = "11";
}
// ® Copyright 2001 ®RJH2001
FlashKit > Flash Help > Flash General Help
Posted on: 07-28-2002, 09:43 AM
View Complete Forum Thread with Replies
Sponsored Links:
Displaying Time And Date
Hi all,
Just upgraded from flash4 to flash5 (when it comes out soon i will get flash6). I upgraded as 5 has alot mor functions in action script. Ok enough of the small talk and to my question.
I want to diplay the current time and date (or just time) on my flash website. I was told you cant do it in flash4 but can in 5. How is it done?
View Replies !
View Related
Displaying Date And Time
Trying to make a clock that displays the date and time. This is a great tutorial. http://www.flashkit.com/tutorials/Ac...22/index.shtml
Althought I can't get it to work. I can't reach the author to get the answer. This is the error message that displays in the actionscript output screen. when you run the movie. It has something to do with the a.m. or p.m. variabe text box. This message repeats itsself in the output and fills the screen with the same message until I stop the movie.
"Target not found: Target="amp" Base="_level0.instance1"
---------------------------------------------------
Here is the actionscript. Thanks in advance.
// ® Copyright 2001 ®RJH2001
// below is what 'creates' the dynamic timing mechanisms
mydate = new Date();
days = mydate.getDay();
month = mydate.getMonth();
months = mydate.getMonth();
day = mydate.getDate();
year = mydate.getFullYear();
hr = mydate.getHours();
min = mydate.getMinutes();
sec = mydate.getSeconds();
amp = mydate.getHours();
//
// below is what sets the am-pm 0-24 to display Am & Pm
if (amp eq "0" or amp eq "1" or amp eq "2" or amp eq "3" or amp eq "4" or amp eq "5" or amp eq "6" or amp eq "7" or amp eq "8" or amp eq "9" or amp eq "10" or amp eq "11") {
tellTarget ("amp") {
gotoAndStop (1);
}
}
if (amp eq "12" or amp eq "13" or amp eq "14" or amp eq "15" or amp eq "16" or amp eq "17" or amp eq "18" or amp eq "19" or amp eq "20" or amp eq "21" or amp eq "22" or amp eq "23") {
tellTarget ("amp") {
gotoAndStop (2);
}
}
//
// below is what sets the days 0-6 to display Sunday thru Saturday
if (days == "0") {
days = "Sunday";
}
if (days == 1) {
days = "Monday";
}
if (days == 2) {
days = "Tuesday";
}
if (days == 3) {
days = "Wednesday";
}
if (days == 4) {
days = "Thursday";
}
if (days == 5) {
days = "Friday";
}
if (days == 6) {y
days = "Saturday";
}
//
// below is what sets the months 0-11 to display January thru December
if (month == 0) {
month = "JANUARY";
}
if (month == 1) {
month = "FEBUARY";
}
if (month == 2) {
month = "MARCH";
}
if (month == 3) {
month = "APRIL";
}
if (month == 4) {
month = "MAY";
}
if (month == 5) {
month = "JUNE";
}
if (month == 6) {
month = "JULY";
}
if (month == 7) {
month = "AUGUST";
}
if (month == 8) {
month = "SEPTEMBER";
}
if (month == 9) {
month = "OCTOBER";
}
if (month == 10) {
month = "NOVEMBER";
}
if (month == 11) {
month = "DECEMBER";
}
//
// below is what sets the minutes 1 thru 9 to display 01 thru 09
if (length(min) == 1) {
min = "0" + mydate.getMinutes();
}
if (length(sec) == 1) {
sec = "0" + mydate.getSeconds();
}
//
// below is what sets the hours 0 and 13-23 to display 1-12
if (hr == 0) {
hr = "12";
}
if (hr == 13) {
hr = "1";
}
if (hr == 14) {
hr = "2";
}
if (hr == 15) {
hr = "3";
}
if (hr == 16) {
hr = "4";
}
if (hr == 17) {
hr = "5";
}
if (hr == 18) {
hr = "6";
}
if (hr == 19) {
hr = "7";
}
if (hr == 20) {
hr = "8";
}
if (hr == 21) {
hr = "9";
}
if (hr == 22) {
hr = "10";
}
if (hr == 23) {
hr = "11";
}
// ® Copyright 2001 ®RJH2001
View Replies !
View Related
Displaying The Compile Date/time Of Swf
I am testing files for a project and am wondering if it's possible to print out to the screen what time it was COMPILED, so I can then create a build number. I can't use get date or anything like that, becauise it will update at runtime. I need it to, once set, stay in place, so I then know exactly which version I am looking at. I could look at the dates of the files, but really need to get it on screen. Any ideas?
View Replies !
View Related
Displaying The Date/time Within A Movieclip
I am trying to display the date/time from within a movieclip. When I put the date/time movieclip in the main timeline it works fine, but when I put the date/time movieclip within another movieclip it doesn't work. Below is the code that I'm using.
I thought it might be a path issue, but I'm not sure how to correct it.
Attach Code
onClipEvent (load){
timedate = new Date(); }
onClipEvent (enterFrame) {
hour = (timedate.getHours());
minutes = timedate.getMinutes();
seconds = timedate.getSeconds();
todaydate = timedate.getDate();
day = timedate.getDay();
dayname = days[day];
month = (timedate.getMonth()+1);
monthname = months[month-1];
year = timedate.getFullYear();
if (length(minutes) == 1) { minutes = "0"+minutes;
}
currenttime = hour+""+minutes;
currentdate = todaydate;
fulldate = todaydate;
delete timedate;
timedate = new Date();
}
View Replies !
View Related
Displaying Earlier Time / Date Values ( Eg. 15 Minutes Ago )
In Actionscript 2, I know how to reference the current date and time, but I'm looking for a way to show what the time was (for example) 15 minutes ago.
I thought this would be easy initially until I thought, what happens if now was 10 minutes past midnight on the 1st January 2008 ? 15 minutes ago would be 11:55 on the 31st December 2007.
I guess I could write lots of if statements to determine if the minutes were <0 or if it crossed over to a previous day, or how many days there were in the previous month (is it a leap year) etc... but I'm wondering if there is an easier way to reference 15 minutes ago.
Thanks
Edited: 12/05/2007 at 03:29:12 AM by _noClue();
View Replies !
View Related
Record The Date & Time Each Time The Flash File Is Played
Hello,
Do you know an action script which will be inserted into each flash
file that is played on a stand alone display monitor.
The display monitor plays several separate flash files using load an un load movie. The script should do
the following:
1. Record the date & time each time the flash file is played
2. Record the file name that played
3. Append this information to a text/log file
This application would be used in-house and is not for the web. I did check out this tatorial useing XML but I counldn't get it to work.
Saving XML to a file when used locally
Saving xml to a file when used locally can be done in two ways, the first is this:
Cookie.setCookie(xmlobj)
and the second way is this:
yourxmlobj.toString() FSCommand("save","filename.xml")
Can you Please give me some kind of direction
Thanks!
View Replies !
View Related
Displaying The Date
Hi,
Simple but causing loads of problems: all i want is to display the current date in this format or similar "10 Jan 2003", but i just can't seem to work it out.
Thanks in anticipation
Ada
View Replies !
View Related
Displaying Date
Hello,
Can someone please tell me how to display the date in a .swf using this method:
http://www.flashkit.com/tutorials/Ac...-808/index.php
But without the time included.. I am trying to disply only (Wed Jan 22)
Cheers,
Mike
View Replies !
View Related
Displaying JUST The Date
on my website i've got the date showing with code:
my_date = new date();
it works fine, but i was wondering how you get rid of the 'time' and the 'GMT+1:00' that comes with it.
I just want it to say 'mon Apr 5'
Any ideas?
View Replies !
View Related
Displaying The Date And Determining *th, *nd, *st
I found a piece of code somewhere for displaying the date (below) but it doesnt get the suffix right, e.g. it will display wednesday 3th December, or 1th etc etc.
It looks like it should check for this, but it fails, any ideas???
Code:
myDate = new Date();
myDay = myDate.getDay();
myNumber = myDate.getDate();
myMonth = myDate.getMonth();
myYear = myDate.getFullYear();
switch (myDay) {
case 0:
myFullDay = "Sunday";
break;
case 1:
myFullDay = "Monday";
break;
case 2:
myFullDay = "Tuesday";
break;
case 3:
myFullDay = "Wednesday";
break;
case 4:
myFullDay = "Thursday";
break;
case 5:
myFullDay = "Friday";
break;
case 6:
myFullDay = "Saturday";
break;
}
switch (myMonth) {
case 0:
myFullMonth = "January";
break;
case 1:
myFullMonth = "February";
break;
case 2:
myFullMonth = "March";
break;
case 3:
myFullMonth = "April";
break;
case 4:
myFullMonth = "May";
break;
case 5:
myFullMonth = "June";
break;
case 6:
myFullMonth = "July";
break;
case 7:
myFullMonth = "August";
break;
case 8:
myFullMonth = "September";
break;
case 9:
myFullMonth = "October";
break;
case 10:
myFullMonth = "November";
break;
case 11:
myFullMonth = "December";
break;
}
exte = "th";
switch (myNumber) {
case 1:
exte = "st";
break;
case 2:
exte = "nd";
break;
case 3:
exte = "rd";
break;
}
currentDate = myFullDay + " " + myNumber + exte + " " + myFullMonth + " " + myYear;
View Replies !
View Related
Displaying The Complete Time And The Time Passed On A Flv
hello all,
i'm trying to get the lenght of a stream(flv) and display it. get the amount of time that has played on the stream and display that, it will look like this in the end :
01:32/09:45
has any one done this and what would be the best way to go about it? i already have a .asc file that grabs the stream.length and brings it back into flash in secs, but that's as far as i've gotton, and i want to go about this the right way. am i going to create a getTimer() object or is there a clientside script that will accurately display the stream.
thanks,
also, how would i go about trimming the extra characters off of the seconds?
View Replies !
View Related
Adding 3 Months To The Date Object (and GetFullYear Displaying Last Two Digits)
I'm currently working on a simple project displaying a date and I've got this so far:
myDate = new Date();
dd = myDate.getDate();
mm = myDate.getMonth() + 1;
yyyy = myDate.getFullYear();
textdate = (mm+"/"+dd+"/"+yyyy);
Works great. Displays proper date like 6/20/2006.
However, here's where things get interesting. Clients wants date to display 3 months into the future. Now sure, I could just use myDate.getMonth() + 4 and it'll work. Sort of. Of course, what if it's 3/31 and since there's no 6/31, that'll look kind of stupid. So what's the workaround for this? Got to be something.
Also, any idea how I can just make the year display as '06' instead of '2006'?
View Replies !
View Related
Date And Time?
I am triing to make a date and time clock using action scripting. This is my code as placed on the first fame of my movie clip:
mydate = new Date(year, month, date, hour, min, sec, ms);
//code is the name of my dynamic text box//
code = mydate.getFullYear()+":"+mydate.getMonth()+":"
+mydate.getDate()+":"+mydate.getHours()+":"+mydate .getMinutes()+":"+mydate.getSeconds()+":"+mydate.g etMilliseconds();
what is troubling me is that all of the code works except for the month which is coming up as 0 instead of 01 (for January). now what I did is add +1 to the script at the getmonth
mydate.getMonth()+1+":"
this seems to work, but I dont know if this is right. can anyone tell me if this is right and if so how come I don't have to do this with all the other parts of the script?
thanks---mike
View Replies !
View Related
Date And Time AS
hello,
I am making a site for my school and i was wondering
how to make the time show and the date. This is what
i mean...
8.52pm
11/03/2002
can someone plase tell me how to do this?
thanks, william
View Replies !
View Related
Date/Time?
Hey, I want to make a button, when released, to display the date and time in a text box.. I cant get it though. I've tried a lot of different things but it aint workin.. Any help? Thanks.
(i couldn't find a tutorial on this, but maybe I didn't search hard enough?) :-/
View Replies !
View Related
GET TIME.DATE
How do you get the REAL TIME? Not the CPU time, coz it tends to be inaccurate.
also, is there a way to have flash evaluate an textfield (input preferably) and have it look for-and remove, specific characters like quotes and stuff..(it messes up my loaded variables.)
Tnx
View Replies !
View Related
Date And Time
Hey guys. I'm just wondering if anyone can point me in the direction of a tute. I want to figure out how to make my webpage detect the date and time on ones computer and then I want it to trigger an animation. Something like have brackets slide across to the right time with the time following the brackets. I can get the time to follow the brackets but I need help getting the brackets to slide according to the persons date.
Thanks in advance .
pea
View Replies !
View Related
Time And Date
i'm not a newbie...but nobody will answer me anywhere else about this...how do i do time and date on my site? what's the AS? please tell me i need to know.
thanks
View Replies !
View Related
Date And Time
was wondering if someone could help me design a simple date time thing, e.g 01/12/02 for my web page, or anything like it would be cool. Ive seen some previous pages on it but found it very confusing, any help or pointer to tutorial would be cool, thanks for help, leo.
View Replies !
View Related
Log Date And Time
Hi All,
There is problem regarding date and time logging when the Flash movie is being sent to some one via Mail. I checked this option by using Cookies but unable to capture the exact results.
thankx in Advance.
View Replies !
View Related
Day, Date & Time
How can you make an application, where the day, date and time is displayed. For example: "Mondag 22 March 11:25" (only then in Dutch so: "Maandag 22 maart 11:25" The time isn't so hard, i've got that already.. only the AS for the date is what i needed.
Search used, notting found, only about the time...
View Replies !
View Related
Date And Time
Hello
Can any one help me with the code for displaying date and time in flash MX in this format
Example: Friday : Feb 07, 2003. hours: min : seconds
Thanks,
Syed
View Replies !
View Related
Date And Time
I've noticed a couple of sites with a date and time display witihin their interface. Does anyone know how to do this, I think that flash gets this data from the local machine's clock, but don't know how to go about acheiving this effect. Can anyone help?
View Replies !
View Related
Date & Time Help
Well, this is a nOoB question:
I'd lie to get the time and date to display in my flash movie, so how do i do that? i know you can create a button and on release you can do some stuff to get date and time, but how do i display it???
Greetz
View Replies !
View Related
Time And Date
OK I am very sure I have done that before but I cant find it + I forgot how to.
I need a box that tells the viewer the time and date...what is the script for that?!
Thx.
View Replies !
View Related
Date And Time
My call to new Date(); tags on a GM...hmmm..
Anyway, what's the best way to grab a date and time...
Something formatted like: November 11, 2003
15:14
ought to do it...
Many tia...
View Replies !
View Related
Date And Time
hello, i am working on a site for a client, i need to just get the date and time on the site, but i have NO idea how to do this. if anyone can give me any help, i dont know what im doing in flash or actionscripting...
any help please.
View Replies !
View Related
Date / Time
Ok I have tried to get date and time to work on my site with no luck and it seems know one can find and fix the issue. Can someone please help me with the correct code for displaying time and date.
Thanks
View Replies !
View Related
Date/Time
Usually when we use the below code, we only get the date and time from the users computer. So if the user has wrong timeset in his computer, flash still fetches the wrong data. Is it possible to get the right date and time irrespctive to the one fetched from the computer so that the user can trust on the Date/Time shown in a flash website(even if his computer shows it wrong) ??
Code:
nowdate = new Date();
array_days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
theday = "["+array_days[nowdate.getDay()]+"]"+nowdate.getDate()+"/"+parseInt(nowdate.getMonth()+1)+"/"+nowdate.getFullYear();
thetime = nowdate.getHours()+":"+nowdate.getMinutes()+":"+nowdate.getSeconds();
View Replies !
View Related
Time/Date Help
So I have this thing that I need to display the date with. However I also needed the fonts broken apart so they look nicer.
So I've got the month abbreviations all in a movieclip, the numbers 1-31 in a movieclip, and the years 2006-2100 in another movieclip. Is there a script that I could put somewhere that would make it display the correct date through this method?
Normally I would just use dynamic text boxes, but I really need the fonts broken apart...
EDIT: This has nothing to do with the time... sorry for putting that in the title.
View Replies !
View Related
Use Of Date And Time?
Hi…
I’m making a application which needs the current date and time. I’ve tried the “normal” way that loads the date and time on the users computer.
Used something like :
currentDate = new Date();
thisYear = currentDate.getFullYear();
The problem here is that it’s very important that the date and time is accurate. I have therefore been searching the internet for different ways of doing this. I’ve found quite a few, but things gets to complicated. What I need is the simplest thing.
I’ve found a PHP version where the PHP is as follows:
<?php
echo "time=" . time();
?>
But how do I get this into Flash?
Hope that someone could help med out!
This is making me very frustrated!
View Replies !
View Related
Date & Time
Hello
I'm using flashmx2004,
Can someone help me with date and time this is what I want to do ex: 7:42 AM-CSD March-18-2004
very simple but I need to know how to make it what is the script needed for this whats the secret guys
View Replies !
View Related
Date & Time
Hello
I was looking at the tutorial on the date&time in the tutorial section of kirupa and I tried it on a new document .
well this is what I got the letters are missing like f in friday and also M is missing for march, the time is ok I get the numbers .
question is way are some letters missing? And when I try to add this in my movie the time doesn't show up in the scene???. anyone know why this happends.
View Replies !
View Related
Date & Time
Hello
I'm using flashmx2004,
Can someone help me with date and time this is what I want to do ex: 7:42 AM-CSD March-18-2004
very simple but I need to know how to make it what is the script needed for this whats the secret guys
View Replies !
View Related
Date & Time
Hello
I was looking at the tutorial on the date&time in the tutorial section of kirupa and I tried it on a new document .
well this is what I got the letters are missing like f in friday and also M is missing for march, the time is ok I get the numbers .
question is way are some letters missing? And when I try to add this in my movie the time doesn't show up in the scene???. anyone know why this happends.
View Replies !
View Related
AS2 - Date And Time...
I have this code that I wrote a long time ago. It is just your basic date and time deal... One problem that I have always had with it is when its noon, it still shows AM and when its midnight, it still shows PM. Here is the code and perhaps you can see my screwup...
Code:
mydate = new Date();
seconds = mydate.getSeconds();
minutes = mydate.getMinutes();
hours = mydate.getHours();
day = mydate.getDay();
date = mydate.getDate();
month = mydate.getMonth();
year = mydate.getFullYear();
if (hours>12) {
hours = hours-12;
ampm = "PM";
} else {
ampm = "AM";
}
if (hours == 0) {
hours = 12;
}
if (minutes<10) {
minutes = "0"+minutes;
}
if (seconds<10) {
seconds = "0"+seconds;
}
if (day==0){
day = "Sunday"
} else if (day==1){
day = "Monday"
} else if (day==2){
day = "Tuesday"
} else if (day==3){
day = "Wednesday"
} else if (day==4){
day = "Thursday"
} else if (day==5){
day = "Friday"
} else if (day==6){
day = "Saturday"
}
if (month==0){
month = "January"
} else if (month==1){
month = "February"
} else if (month==2){
month = "March"
} else if (month==3){
month = "April"
} else if (month==4){
month = "May"
} else if (month==5){
month = "June"
} else if (month==6){
month = "July"
} else if (month==7){
month = "August"
} else if (month==8){
month = "September"
} else if (month==9){
month = "October"
} else if (month==10){
month = "November"
} else if (month==11){
month = "December"
}
time = ((hours) + ":" + (minutes) + ":" + (seconds) + " " + (ampm));
datefinal = ((day) + " " + (date) + " " + (month) + " " + (year));
I would also like to convert this to AS3. I am a total rookie when it comes to AS3, so any help here would be appreciated.
View Replies !
View Related
|