Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Clock



hi there,

I'm creating this music player in flash. which loads the mp3 files and the titles through txt files.
the problem is, I have to create a clock (more sort of a counter) which counts the seconds and minutes of the file that's playing..

I got this code.. but it's not based on the particular song that's playing... it just starts counting when u click the play button... and sometimes it starts before the song has loaded... :s

code:

onClipEvent (load) {
timer = "00:00";
counting = false;
startTimer = function () { counting = true;baseTime = getTimer();};
stopTimer = function () { counting = false;baseTime = timer;};
}

onClipEvent (enterFrame) {
if (counting) {
time = Math.round((getTimer()-baseTime)/1000);
seconds = time%60;
minutes = Math.floor(time/60);
secs = (seconds<10) ? "0"+seconds : seconds;
timer = "0" +minutes+":"+secs;
}

I just don't know how to write a script which is based on the length of the song thats playing at that moment... should I also put all the lenghts of the mp3's in a txt file and write a code from there?

I just don't know where to start!

I hope someone could help me out here cuz I have to get it finished by today for a big client! :s

lots of thanks you's if ya can help me!!!

greetings,

Manda
Multimedia student @ the netherlands
manda_bryan@hotmail.com



FlashKit > Flash Help > Flash ActionScript
Posted on: 09-26-2003, 05:25 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Mobile Phone Clock - Simple Digital 24 Hour Clock
Hi

I need to make a digital clock/watch for a mobile phone flash demo. I know there are lots of clock on flash kit but they all have seconds and minutes - I need just hours and minutes! - The clock also has to be 24 hour.

I've tried taking the code from a flash kit clock and tweaking it but it seems to screw up - for example 07.03 comes out as 7.3 - looks really naf like that!

If anyone can help me out with a source file or some code I would be most greatful!

<b>I Need A Clock, Please Help Me, Need Full Information To Make A Flash Clock</b>
need some info please help. heed some help


i am swedish and 13 winters old nEEd english email-friend please nobody in sweden doesent understand flash , so badly....

........
.... ::: CHASER ::: ....

Countdown Clock (sync With Server Clock In .asp) PLEASE HELP
I used Senocular's awesome countdown clock tutorial found here:

http://www.kirupa.com/developer/mx/countdown2.htm

but I need to figure out how to sync it to my server's clock (I understand I must do this in a .asp file and then load that into flash).

Using vbscript this is what I tried, but obviously it doesn't work I think I may need to convert it completely to seconds first before bringing it into flash:

<%
Dim MyTime
MyTime=now()
response.Write("time="&MyTime)
%>

Does anyone have any ideas?

Thanks so much!

Detecting Clock Wise And Anti Clock Wise Rotation
hey troops!

nube's first post.

can you tell me if it is possible to detect if an object is rotating anti clockwise or not?

at present i get x,y co-ords and use the code below to rotate it which is fine. now i could write an if statement to check if rotation is negative or positive but because rotation can be negative and positive when rotating clockwise and anti clockwise this wouldnt work.

any ideas?


Code:
theAngle = Math.atan2(diffy , diffx);

this._rotation = theAngle*360/(2*Math.PI);

updateAfterEvent();
cheers in advance

Detecting Clock Wise And Anti Clock Wise Rotation
hey troops!

nube's first post.

can you tell me if it is possible to detect if an object is rotating anti clockwise or not?

at present i get x,y co-ords and use the code below to rotate it which is fine. now i could write an if statement to check if rotation is negative or positive but because rotation can be negative and positive when rotating clockwise and anti clockwise this wouldnt work.

any ideas?


Code:
theAngle = Math.atan2(diffy , diffx);

this._rotation = theAngle*360/(2*Math.PI);

updateAfterEvent();
cheers in advance

Clock
how do i get the time and date on my flash page?????

CLOCK
okey firstly i dont want a clock i my site.....but i want the site to react to the clock on the system that it is on.

Is there a way in which i could set the _alpha of a layer according to the time. i.e if its eight oclock at night set the alpa of 'so and so' layer to 20%.

Would there be anyway of doing it subtly say at 8 oclock the alpha of a layer is at 0 and by midnight it is 100, filling in the bits in between gradually

any ideas anyone

thanks

Clock
I REALLY need a clock in my flash movie. Here's the catch though - I need the movie to display both Uk and USA times - bear in mind that the browser may be in either the UK or US when viewing the movie though.

Please can you help me?

Thanks

Clock - Please Help
Hi

I need to make a 24 hour clock with just hours and minutes (without seconds!).

I know it sounds simple enough but the problem I'm having is that 17:05 is 5:5 - seems to take out 0's and looks naf

I desperatley need some code or a source file and would be most greatfull if anyone could help

Clock
ok i just tried two difernt tutorials on the fk site to make a clock that would read off the person computer and hten work as if it was a realy time clock.

Im using flash mx.

Whe i loaded the clock in the browser and the player it didnt work...

On one clock it just read 0:0:0

on the other it had the right time but it didnt change you would have to change the page each time.


Both tut's were for flash 5 this could be the problem if so are there any flash mx tut's out there for a clock?

Clock
Hi!!

First, I don't speak inglish verry well, I hope you understand my problem: I have built one clock in flash and all is perfect but I work in a little radio station and I want to put in my clock movie one more thing: the signals of "o'clock". Each hour I want play this sound incluided in the movie "bip bip bip bip bip biiiiiiiip" You know? Thanks for help me.

SPANISH: Hola!

he crerado un reloj en flash MX y funciona muy bien. Trabajo en una pequeña radio y quisiera saber si en la película de mi reloj se puede poner un actionscript que hiciera sonar cada hora un sonido incluido en la película. Sería reproducir cada hora las señales horarias, el típico "bip bip bip bip bip biiiiiip" ¿sabes lo que quiero decir? Espero que puedan ayudarme.

now in FRENCH:

Salut!!
j'ai crée un film en Flash MX d'une montre qui fonctionne très bien mais je travail dans une petite radio et je voudrai mettre, par le moyen d'un actionscript, chaques heures les bip qui indique qu'il est par exemple 15:00 pile. C'est à dire le "bip bip bip bip bip biiiiiiip" Peux-tu m'aider???


THANKS !!!!!!!!!!!!!!!!!

Clock
I've noticed some clock/time "commands" in Flash 5, but I don't know how to use them, If you know, please help me

Clock...
i found a tutorial on flashcircle but that site is gone , i want to make an animated clock that displays the real time , 9:57 and so on not military time.... anyone know where i can find a tut like this. thanks in advance ,

-jc

Gmt Clock
Can I have a flash clock that shows gmt time rather than taking the time from the computers system

Clock..HELP
my flash clocks (both digital and analog) are an hour ahead when i view them on my computer. but when i upload them on the web, they display the corect time.. what could be the prob?

TCR Clock
Does anyone know how I would go about making a TCR clock. Like what you would see on video playback

Code:
Tcr 11:24:19
Thanks

Clock Help
How can i keep the clock from reseting when the clock is taken away n brought back:
http://209.204.165.10/eric/clock.swf

Clock
OK I did a tutorial on making an analog clock
"http://www.flashkit.com/tutorials/Actionscripting/Real-Tim-Marcos_J-187/index.php"
I followed the instructions perfectly. It says to put this code in:

code:
onClipEvent (enterFrame) {
MyDate = new Date();
hour = MyDate.getHours();
minute = MyDate.getMinutes();
second = MyDate.getSeconds();
if (hour> 11) {
hour = hour-12;
}
hour = hour*5;
movement = minute/12;
hour = int(hour+movement);
with (_root.Clock.Hours) {
gotoAndStop(hour) + 1;
}
with (_root.Clock.Minutes) {
gotoAndStop(minute) + 1;
}
with (_root.Clock.Seconds) {
gotoAndStop(second) + 1;
}
}



However it says that the script has no errors until I try the swf file. Can someone help me on this manner please

Thank you

Clock
I'm trying to make an analog flash clock on my site that will show
my local time without depending on the users computer clock.
means from any country you will see the same hour, which is the time in my office.
any ideas?

Clock Help
Hey There,

I have been following the many great clock tutorials here at flashkit, however with all of them, once I test my clock, the hands seem to move independantly of each other and move off to different points around the clock, even though I followed the tutorial to the letter!

Has anyone else had this problem and was able to correct it?

Please help me out, it's driving me nuts!!!

The version I'm using is flash5 if that makes any difference!

Thanks

Non Cpu Clock
hi everyone,

i got this countdown clock some time ago but i'm not too sure how to get it to show the CURRENT time rather than counting down?

it runs from the server of the website.

is it easy to add the day of the week?

i've attached the files...

paul.

GMT/UTC Clock?
Hi peeps.

I have this code:

Code:
onClipEvent (load){
mon = ["01","02","03","04","05","06","07","08","09","10","11","12"];
weekdays = ["SUN","MON","TUE",
"WED","THU","Fri","SAT"];
}
onClipEvent (enterFrame){
now = new Date()
nDay = weekdays[now.getUTCDay()]
nMonth = mon[now.getUTCMonth()]
nDate = now.getUTCDate()
nYear = now.getUTCFullYear()
displayDate = nDay+", "+nDate+"/"+nMonth+". "+nYear
}
&

Code:
onClipEvent (enterFrame) {
myTime = new Date();
nSeconds = myTime.getUTCSeconds();
nMinutes = myTime.getUTCMinutes();
nHours = myTime.getUTCHours();
if (length(nMinutes) == 1) {
nHinutes = "0"+nMinutes;
}
if (length(nSeconds) == 1) {
nSeconds = "0"+nSeconds;
}
nTime = nHours+":"+nMinutes+"."+nSeconds+" GMT";
displayDay = nDay
}
It works pretty well but it still goes out of sync if you change your PC time.

Anyone got any idea how I can get it to update via somewhere other than the CPU clock??

Cheers guys~

Clock
(This is not a real time clock)I am currently trying to develop a clock movie clip using actionscript. I have created the MC (clockface, hourhand and minutehand).

would i am trying to do is

1. rotated each hand separately so that they stop at specific point round the clockface.

2. MC minutehand will rotate to 5 minutes 10 minutes and so on, then MC hourhand will rotate 1 hour 2 hour and so on.

can anyone point me in the right direction or send me some use full tutorials that will enable me to do this.

this is would have done so far - thought I had it figured out on Friday. I am a newbie to actionscript!


PHP Code:



onClipEvent (enterFrame) {
     if (_root.hourHand._rotation == 0) {
          _root.hourHand._rotation = 30;
          _root.hourHand._rotation = 60;
          _root.hourHand._rotation = 90;
          _root.hourHand._rotation = 120;
          _root.hourHand._rotation = 150;
          _root.hourHand._rotation = 180;
          _root.hourHand._rotation = 210;
          _root.hourHand._rotation = 240;
          _root.hourHand._rotation = 270;
          _root.hourHand._rotation = 300;
          _root.hourHand._rotation = 330;
          _root.hourHand._rotation = 360;
     }else{
          _root.hourHand._rotation = 0;
     }


Clock
Hi,

How do I make a clock HH:MM:SS AM or PM that I can adjust the time?

I don’t what this to change the time on my computer.

Clock
hi I have created a clock, it works, but it doesn't show zero if the number is under 10, so, can anybody tell me what I missed in AS? for an example: 11:9:4 and I want it 11:09:04







Attach Code

var myTimer:Timer = new Timer(1000);
myTimer.start();

myTimer.addEventListener(TimerEvent.TIMER, showtime);
function showtime(myevent:Event) {
var myDate:Date = new Date ();
var currentHour:Number = myDate.getHours();
var currentMinute:Number = myDate.getMinutes();
var currentSecond:Number = myDate.getSeconds();

if (currentHour == 0) {
currentHour = 12;
}
hodiny_txt.text = "
" + currentHour + ":" + currentMinute + ":" + currentSecond;
}

Clock........?
i know how to script for the clock but the major prob is how do i make my movie n a clock run parallely together....???...cos clock has the script: GoToAndPlay (1), which makes the movie, to go n play from frame 1 but i want my movie to run from frame 3...how do i do it.....?

Clock
Hi me again! I'm trying to do the digital clock using the tutorial on the site, but without the day and time but I can't seem to make it work, this is the script i'm using

onClipEvent (enterFrame) {
myTime = new Date();
nMinutes = myTime.getMinutes();
nHours = nTime.getHours();
if (nHours>=12) {
ampm = "pm";
}else{
ampm = "am"
}
if (nHours>=13){
nHours = nHours-12
}
if (length(nMinutes)==1){
nMinutes = "0"+nMinutes;
}
nTime = nHours+":"+nMinutes+""+ampm;
}

any clues as to what i'm doing wrong? Thanks in advance!

Clock Help
i'm using my personal website to keep my family and friends in on what's going on over here in Iraq and i thought it would be cool to include west coast, mountain, and Iraq time all on my webpage for them. Our wing webpage has an example https://www.blab.centaf.af.mil. Anybody have a clue how to do this with actionscript so i can add it to my website?

Regarding The Clock....
I'm putting in two digital clocks on a flash movie. The first one will show local time, the other a time in another part of the world. (+4 GMT). First, here is the code I'm working with:

Code:
time=new Date(); // time object
var seconds = time.getSeconds()
var minutes = time.getMinutes()
var hours = time.getHours()
if (hours<12) {
ampm = "AM";
}
else{
ampm = "PM";
}
while(hours >12){
hours = hours - 12;
}
if(hours<10)
{
hours = "0" + hours;
}
if(minutes<10)
{
minutes = "0" + minutes;
}
if(seconds<10)
{
seconds = "0" + seconds;
}
clock_txt.text = hours + ":" + minutes + ":" + seconds +" "+ ampm;
Where in this would I set it so it will reflect the +4 GMT time?

Thanks in advance!
Tay

Clock
i´m using this code to make a digital clock:

onClipEvent (enterFrame) {
myTime = new Date();
nMinutes = myTime.getMinutes();
nHours = myTime.getHours();

if (hours>=13) {
nHours = nHours-12;
}
if (length(nMinutes) <= 1) {
nHinutes = "0"+nMinutes;
}
nTime = nHours+":"+nMinutes+nSeconds+" "+ampm;
}


The problem is that when the minutes are <10, it´s shown like this>

13:9 pm

how do I solve this?^

thanks

Clock
I tried to complete a turotial on clocks @ http://www.flashkit.com/tutorials/Ac...-591/index.php but it won't work for me. If any of you have experience with designing flash clocks, can you briefly explain it to me or send me the .swf?

Clock........?
i know how to script for the clock but the major prob is how do i make my movie n a clock run parallely together....???...cos clock has the script: GoToAndPlay (1), which makes the movie, to go n play from frame 1 but i want my movie to run from frame 3...how do i do it.....?

Clock
Hi me again! I'm trying to do the digital clock using the tutorial on the site, but without the day and time but I can't seem to make it work, this is the script i'm using

onClipEvent (enterFrame) {
myTime = new Date();
nMinutes = myTime.getMinutes();
nHours = nTime.getHours();
if (nHours>=12) {
ampm = "pm";
}else{
ampm = "am"
}
if (nHours>=13){
nHours = nHours-12
}
if (length(nMinutes)==1){
nMinutes = "0"+nMinutes;
}
nTime = nHours+":"+nMinutes+""+ampm;
}

any clues as to what i'm doing wrong? Thanks in advance!

Clock
I made this clock if you want it use it

www.byngdesigns.co.uk/tek-tips/clock.swf
www.byngdesigns.co.uk/tek-tips/clock.fla

Regards
David Byng

www.byngdesigns.co.uk
davidbyng@hotmail.com

Clock
I am trying to make a classic pocket watch, I am not good at the formula stuff, anyone know a formula i can use to tell the differnet hands how to rotate?  like the hour hand minute hand and second hand.. its not showing actual time i just need it to look realistic

Clock
I'm using Flash 5 and I want to create a clock. I've made a movieclip of one of the hands and I created an instance of it, called 'hand_seconds'. How do I actually get it rotated?
I tried the following, but it doesn't work.

seconds.getSeconds()
seconds2 = (seconds/360)*60
setProperty (hand_seconds, _rotation, seconds2)

Could anybody help me please?

1 Am Clock AS
Can anyone tell me how to make 12 AM show as 12:XX:XX instead of 0:XX:XX?

thanks so much


ActionScript Code:
time=new Date(); // time object
var seconds = time.getSeconds()
var minutes = time.getMinutes()
var hours = time.getHours()
if (hours<12) {
ampm = "AM";
}
else{
ampm = "PM";
}
while(hours >12){
hours = hours - 12;
}
if(hours<10)
{
hours = "0" + hours;
}
if(minutes<10)
{
minutes = "0" + minutes;
}
if(seconds<10)
{
seconds = "0" + seconds;
}
clock_txt.text = hours + ":" + minutes + ":" + seconds +" "+ ampm;

Count Down Clock
I need help creating a count down clock. One which will count down from 5 minutes and include seconds and minutes. I need for a scoreboard I'm making I would also like to know if it would be able to stop the clock so to pause a game. Thanx

Clock Time
I need to create a clock that counts down using not only hours, minutes and seconds but also 10's/100's and 1000's of seconds.

I have been able to create a clock that counts down as per the usual standard, but can get no further.

This is the code so far:

myDate = new Date();
seconds = myDate.getSeconds();
minutes = myDate.getMinutes();
hours = myDate.getHours();
seconds2 = 59-seconds;
minutes2 = 59-minutes;
hours2 = 23-hours;
if (length(minutes2) == 1) {
minutes2 = "0" + minutes2;
}
if (length(seconds2) == 1) {
seconds2 = "0" + seconds2;
}
timetil12 = (hours2+":"+minutes2+":"+seconds2);

Clock In Flash5
Hi all,

I have a problem with my clock in flash. It displays everything I want except the hours are coming through as Military time. ie 5pm is 17..... can anyone tell me how to correct this??

Thanks in advance.

Quester

Analoge Clock
hi
i have to make an analoge clock
i tried it like this
//for each pointer

my_Date = new Date();

sek = my_Date.getSeconds();

for(i=0;i<=sek;i++) {
seconds_pointer._rotation = 6; //same with minutes, hours
}

but the pointer only moves 6 degrees and stops!


if i write seconds_pointer._rotation += 6;
it moves 6 degrees every frame




can anybody help me plz

thx
bo

System Clock
How do I use action script to simply change a photo once every hour according to the system clock?

Countdown Clock
I want to run a full screen countdown clock. It needs to be able to count down to a certain time/date ie. New Years Eve etc. in large text or with variable font

Regrard,

Cian Byrne

Digital Clock
Pleas Help

How i can Build in Flash 4 Digital Clock

Thanks

Help My Clock Tickking
I'm trying to get an analog clock to work.

I manage to do so sofar... (excuse me, it's all in Dutch ), but for some reason I cann't get it to work in this SITE. Click in this site ball no. 4 from above in left menu (excuse me, it's even more "all Dutch" ) .

Whatever I've tried, copy / paste 'Rustruimte.html'- Javascript in html of my pop-up 'default2.html', it doesn't work. I probably do something terrible stupid? Perhaps the script needs to be modified a little? Or...?

I hope someone can help, and tell me what and where exactly to copy / paste for I don't know much..., and yet tried so many myself

All tips are more than welcome. Tnkx in advance.

A Script Clock
Hi

I have a question about actionscript. How do I make a working clock in a textfield? Is it possible to just insert somekind of script to a text field to make it work?

Thanks

Clock Actionscript Please Please Help
Hi All

does anyone out there know whether it is possible to create a clock within flash , that displays time date and year
am i being to far fetched?
is this possible
if so can anyone point me to tutorials or source files on this
please
this is really urgent need to know stuff
thanks
J

How Do You Make A Clock?
Is there any way to make a clock in Flash using action script?? Just a basic clock that displays numerals ... not a winding clock. Is it possible???

Please help!!!

Countdown Clock
I want to know how to do a countdown clock, but not in text. I want to incorporate a graphic instead, and i would just like to know how to start and what to do from there. I appreciate all the help i get. Thanks all.

Copyright © 2005-08 www.BigResource.com, All rights reserved