Be a Supporter!

Clock Countdown

  • 334 Views
  • 13 Replies
New Topic Respond to this Topic
svsaproductions
svsaproductions
  • Member since: Nov. 15, 2008
  • Offline.
Forum Stats
Member
Level 07
Programmer
Clock Countdown 2009-02-10 08:45:58 Reply

Hello,

How can I create clock (just a dynamic txt field) with minutes and seconds that counts down, when it gets to a minute it turns red, but if it hits Zero, it goes to a frame, let's say frame "game over".

Please help,

-Jim


me.addEventListener(Event.Whenever_
You_Move, function (e:Event):void { gotoAndSay("WTF?") } );
On. actionComplete(run);

BBS Signature
liam
liam
  • Member since: Dec. 11, 2004
  • Offline.
Forum Stats
Member
Level 22
Blank Slate
Response to Clock Countdown 2009-02-10 09:17:34 Reply

You'd be best making a function such as:

function timeConv(sec:int):String {
var mins:int = 0;
while(sec>=60){
mins++;
sec-=60;
}
return String(mins+":"+sec);
}

(probably not perfect I just wrote as an example) and then just have an int variable named time with the maximum time and each second take away 1 from it, have something like:

mytextbox.text = timeConv(total_time);

Sup, bitches :)

BBS Signature
Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to Clock Countdown 2009-02-10 09:19:55 Reply

For changing the colour of the clock press F1 in Flash and look up textFormat.color. Hex for red is 0xFF0000


- - Flash - Music - Images - -

BBS Signature
Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to Clock Countdown 2009-02-10 09:35:03 Reply

Countdown clock (fla)
AS: Clock by Glaiel_Gamer


- - Flash - Music - Images - -

BBS Signature
liam
liam
  • Member since: Dec. 11, 2004
  • Offline.
Forum Stats
Member
Level 22
Blank Slate
Response to Clock Countdown 2009-02-10 09:45:34 Reply

At 2/10/09 09:35 AM, Denvish wrote: Countdown clock (fla)
AS: Clock by Glaiel_Gamer

Brown nose!

Fantastic coding style by the way, I guess doing it for a job it just comes natural.. commenting so meticulously.. unless you only did that for the guys benefit ^_^


Sup, bitches :)

BBS Signature
svsaproductions
svsaproductions
  • Member since: Nov. 15, 2008
  • Offline.
Forum Stats
Member
Level 07
Programmer
Response to Clock Countdown 2009-02-10 10:07:08 Reply

Thanks guys, I really appreciate it... Thanks,

-Jim


me.addEventListener(Event.Whenever_
You_Move, function (e:Event):void { gotoAndSay("WTF?") } );
On. actionComplete(run);

BBS Signature
Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to Clock Countdown 2009-02-10 10:41:23 Reply

At 2/10/09 09:45 AM, liaaaam wrote: Fantastic coding style by the way, I guess doing it for a job it just comes natural.. commenting so meticulously.. unless you only did that for the guys benefit ^_^

Nah, they're both functions I re-use for quite a few of the games I make, I learnt the hard way that going back into old projects is a LOT harder without comments


- - Flash - Music - Images - -

BBS Signature
svsaproductions
svsaproductions
  • Member since: Nov. 15, 2008
  • Offline.
Forum Stats
Member
Level 07
Programmer
Response to Clock Countdown 2009-02-10 11:18:21 Reply

Anyways, thanks for sharing the code and movieclip, it's just what I needed and worked excellent with a change of font. :)


me.addEventListener(Event.Whenever_
You_Move, function (e:Event):void { gotoAndSay("WTF?") } );
On. actionComplete(run);

BBS Signature
svsaproductions
svsaproductions
  • Member since: Nov. 15, 2008
  • Offline.
Forum Stats
Member
Level 07
Programmer
Response to Clock Countdown 2009-02-11 19:49:38 Reply

Actually, this is as2... when transfered to my as3 movie... KABOOM.... PLEASE POST AN AS3 CLOCK!!!! PLEASE!!!!! Sorry I didn't specify this earlier.!


me.addEventListener(Event.Whenever_
You_Move, function (e:Event):void { gotoAndSay("WTF?") } );
On. actionComplete(run);

BBS Signature
svsaproductions
svsaproductions
  • Member since: Nov. 15, 2008
  • Offline.
Forum Stats
Member
Level 07
Programmer
Response to Clock Countdown 2009-02-11 20:11:29 Reply

anyone?


me.addEventListener(Event.Whenever_
You_Move, function (e:Event):void { gotoAndSay("WTF?") } );
On. actionComplete(run);

BBS Signature
svsaproductions
svsaproductions
  • Member since: Nov. 15, 2008
  • Offline.
Forum Stats
Member
Level 07
Programmer
Response to Clock Countdown 2009-02-12 06:54:52 Reply

but noone is answering me... Please answer


me.addEventListener(Event.Whenever_
You_Move, function (e:Event):void { gotoAndSay("WTF?") } );
On. actionComplete(run);

BBS Signature
Luis
Luis
  • Member since: Apr. 23, 2000
  • Offline.
Forum Stats
Member
Level 02
Melancholy
Response to Clock Countdown 2009-02-12 09:10:47 Reply

At 2/12/09 06:54 AM, svsaproductions wrote: but noone is answering me... Please answer

most people are still sleeping at 6 am... chill out.


None

svsaproductions
svsaproductions
  • Member since: Nov. 15, 2008
  • Offline.
Forum Stats
Member
Level 07
Programmer
Response to Clock Countdown 2009-02-12 12:26:53 Reply

What about now?


me.addEventListener(Event.Whenever_
You_Move, function (e:Event):void { gotoAndSay("WTF?") } );
On. actionComplete(run);

BBS Signature
knugen
knugen
  • Member since: Feb. 7, 2005
  • Offline.
Forum Stats
Member
Level 42
Programmer
Response to Clock Countdown 2009-02-12 12:45:25 Reply

Look what I found in a Google search.