Avatar billede dr.m Nybegynder
29. juni 2004 - 16:36 Der er 11 kommentarer og
1 løsning

World clock time zone

Hello there..

The page:
http://viehweg.dk/world/time.html

The code:
View source

The problem:
How do I make the 8 hour time difference?
I have seen some Java code that will do it, but I kinda like this flash.

Thanks

/Michael
Avatar billede mat Nybegynder
29. juni 2004 - 16:52 #1
something like:

d = new Date();
trace(d.getHours());
d.setHours(d.getHours()+8);
trace(d.getHours());

?

..obviously you are aware that this only is the time on the clients machine?
Avatar billede dr.m Nybegynder
29. juni 2004 - 17:00 #2
Thanks Mat.

I am aware.
Just that I am no programmer.
Where do I apply the code? I never made a flash file.

Also, what if I wanted a flash that will change the time difference according to the html code so that I can add other countries later on.

/Michael
Avatar billede Kengun Praktikant
29. juni 2004 - 17:05 #3
you can't just apply the code. first you have to make the clock in Macromedia Flash then add the code as an "action" in Macromedia Flash.
Avatar billede mat Nybegynder
29. juni 2004 - 17:09 #4
kengun is right. I thought you did the clock yourself and just needed to add 8 hours? Theres plenty of downloadable flash source files out there. Just google them :)

Depending on their specific implementation you have to do something like the above mentioned to set the time for another timezone.
Avatar billede dr.m Nybegynder
29. juni 2004 - 17:11 #5
right.

Can anyone help make the clock?
Here is the existing flash http://viehweg.dk/world/relog.rar

Much appreciated.
Avatar billede mat Nybegynder
29. juni 2004 - 17:17 #6
I dont have winrar installed, and I dont need it :)

Here's a tutorial on doing an analogue clock i flash mx: http://www.webthang.co.uk/tuts/tuts_fmx/eric1/eric1.asp

When doing a clock thats some hours ahead (or behind) just find the place in the code where it says getHours() and change it with setHours() like in my example.
Avatar billede dr.m Nybegynder
29. juni 2004 - 17:20 #7
Thanks.. will try
Avatar billede Kengun Praktikant
29. juni 2004 - 21:29 #8
dr.m> to "manipulate" the clock in the file above we need the .fla file. The .fla file is the workfile for Macromedia Flash. Then we can add the +8 hour.
Avatar billede dr.m Nybegynder
29. juni 2004 - 21:45 #9
Doh, I am afraid that's gonna be a problem as I don't actually have one..
Avatar billede larsholmgaard_dk Nybegynder
30. juni 2004 - 09:16 #10
.fla files are the source files which are directly editable in flash. It is like a recipe containing all the different parts needed for the cake.

.swf files are the compiled versions of the source files and therefore they cannot be edited directly. It is like a cake made from the recipe - you cannot leave out the milk if it is already mixed up... ;-)

The most elegant way to solve this problem is to rebuild the flash clock from scratch and make it read the time difference externally from either a php/asp or even just an html page. By setting two local variables externally, like "city=Copenhagen&timeDifference=1" for example, you could have several instances of the same flashclock even on the same page, showing different time in different cities.

This is the way I would do it - of course it takes some time developing it, but in my opinion it is the most versatile solution since you don't have to edit the flash code and then recompile an swf file for each time setting. You can just set the values externally.

Good luck to you! :-)

Best regards
larsholmgaard.dk
Avatar billede dr.m Nybegynder
30. juni 2004 - 09:27 #11
Thanks
Avatar billede larsholmgaard_dk Nybegynder
30. juni 2004 - 12:40 #12
You're welcome
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
IT-kurser om Microsoft 365, sikkerhed, personlig vækst, udvikling, digital markedsføring, grafisk design, SAP og forretningsanalyse.

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester