Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to set a timer?

Posted on 2005-03-17
4
Medium Priority
?
316 Views
Last Modified: 2010-04-03
Hell flashexperts,

At frame 1 in want to start a timer.
at a certain point i my movie my movie will be directed
to for example frame 40. in that frame i would like to stop the timer
and display it on the screen.
for example :"" you're time was --minutes --sec.
how do i do that?

Kind regards
Steven
0
Comment
Question by:stevenvervliet
  • 2
4 Comments
 
LVL 14

Expert Comment

by:trigger-happy
ID: 13571914
frame 1:
_global.timed = getTimer();

frame 40:
temp = getTimer();
elapsed = temp - _global.timed;

Basically, on frame 1, the amount of time that has elapsed since the start of the movie is taken down into a global var. On frame 40, the temp var will check the time that has elapsed since the start of the movie, the the elapsed var will take down the diff between the 2 in miliseconds. I'm sure you can handle the rest of the process from here ;-)

--trigger-happy
0
 
LVL 39

Accepted Solution

by:
blue-genie earned 200 total points
ID: 13572238
the only problem with using getTimer is that it is a readOnly value, and it keeps going, another way of doing it will be to use setInterval,

so in your first frame

function callback() {
      valuer = valuer+1;
      trace(valuer);
}
valuer = 0;
id = setInterval(callback, 1000);


then in frame 40 you clear the interval (i.e tell it to stop) and show the result (using a trace here) you can just display valuer in a textbox or whatever, its a variable.

clearInterval(id);
trace("final time is: " + valuer);
stop();//if required

blu.
0
 

Author Comment

by:stevenvervliet
ID: 13685734
Thank you BLU, it works JUST fine....

Kind regards
Europe
Belgium
Antwerp City
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 13695398
np :)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question