Question About GetTimer() Command
I have a clock running in my movie. It's is a variable that is updated by the getTimer() command.
But the result of the getTimer() command is the time the main movie started and I want to get the time one of my sub movies started.
But getTimer(subMovie) doesn't work...
Anyone how to pull it of ?
FlashKit > Flash Help > Flash ActionScript
Posted on: 07-27-2001, 05:03 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
AS3 - After Command Another Command That Starts A Jump To A Specific Frame
Hi everyone,
I am a newbie using Flash CS3 and Actionscript 3.0. I have spent hours looking through forums and found no answer to my problem. Maybe it is because it's not possible but I just wanted to see if an expert can help me out.
I have a button and a few animations. Basically when I click the button I want to say: "When you are pressed down I want you to play at this specific frame for this many frames and then jump to a specific frame and play on there."
wrong code until now:
btn1.addEventListener(MouseEvent.CLICK,go1);
function go1(event:MouseEvent):void{
gotoAndPlay("frame10");
}
if (you get to "frame 15"){
then gotoAndPlay("frame5")
}
Any help would be very much appreciated!
Command...variable? Help... Hey, So I Need To Know The Command To Close The Presentat
Hey, so I need to know the command to close the presentation you are in after you click on a linked button to another page... anyone know? or have any questions...... plzzzzzzzz respond...
Hey, what is the command, or properties to have a button GoTo a html link on a release mouse command and the have the presentation (or .swf/.exe projector) close and go get the html that the button was linked to?...
need more info? ask away... tristan@tri-stan.com
thanks,
tri
Command To Run A Flash File From Command Line
Hi All,
I have made a flash application.Suppose the file name is a.swf.
Now I want to run the swf file using a command from the command line..Can anyone please help me regarding this..??
Thanks in Advance,
Nirmal.
FS Command,how To Catch FS Command Using Javascript Not In Vbscript
Hi,
I'm modifying a flash.... and flash uses FS Command.
can you help me catch the fs command in javascript code?? because what I have is the vbscript code, and it does not work on some browsers.
here's the vbscript code(the problem)that calls the function:
PHP Code:
<SCRIPT LANGUAGE="VBScript">
<!--
// Catch FS Commands in IE, and pass them to the corresponding JavaScript function.
Sub mainmenu_FSCommand(ByVal command, ByVal args)
call mainmenu_DoFSCommand(command, args)
end sub
// -->
</SCRIPT>
here is the other part of the script in the page ...javascript code(works fine):
PHP Code:
<script language="JavaScript">
function mainmenu_DoFSCommand(command, args)
{
if (command == "showAd")
{
if (document.layers){
daMenu = document.layers[args];
}
else if (document.all){
daMenu = document.all(args).style;
}
daMenu.visibility = visible;
}
if (command == "hideAd")
{
if (document.layers){
daMenu = document.layers[args];
}
else if (document.all){
daMenu = document.all(args).style;
}
daMenu.visibility = hidden;
}
}
</script>
my problem is to pass the arguments in using javascript(not vbscript) so that it will work on others browsers.
other options is to modify more the vbscript so that it will work on more other browsers...
but I dont know anything about vbscript and only basic javascript...
need help thanks a lot in advance.
MC/getTimer?
Hello,
Let me see if I can explain this.........
I am trying to play a MC on a timed event(getTimer). I have a MC on the main timeline......
onClipEvent (load) {
time_out = .2*60*1000;
}
// would be about 12 sec, for testing
onClipEvent (mouseMove) {
last_move = getTimer();
}
onClipEvent (enterFrame) {
if ((last_move+time_out)<getTimer()) {
tellTarget ("_root.ballholder") {
gotoAndPlay (2);
}
}
}
Inside that MC I have another MC with a stop on the first frame and another MC(3rd) on the 2nd frame. the 3rd movie clip is a simple motion tween, ball going across the stage. It all works fine except the motion tween in the third MC wont play? It shows the ball with no movement, and exits upon mouse move. Why would the 3rd MC's timeline not play through? I would like to loop the 3rd MC, but I can't even get it to play through once, let alone loop. Any ideas?
Thx in advance!
~GD~
GetTimer?
hello...im working on a game that needs a timer so i used the getTimer action and it works fine until i go to reset it. i need to be able to do this because i need the timer to start at 0 for each leval of the game...so how do i reset the timer?
i tried to just set the varible the was assigned the timer to zero but thats a no go...
any suggestions welcomed...
GetTimer() -- Please Help
hi.
Im working with creating a timer for a game.
1.Timer starts on frame 2 of movie.
2.Displayes the current time (always changing).
3.When you get to the end and hit the "agian" button movie goes to frame 2 again and timer starts over.
my question is:
How do i record the amout of time that has passed from the start (on frame 2) to the End as a static number??
as i have it, it records the amount of time SINCE THE MOVIES STARTED PLAYING (not from when the playhead entered frame 2 the last time around)
Please Help!!
I can show my code if that does any good.
Thanks,
Jodi
HELP GetTimer Can Be Set To 0?
I have a swf with different scenes and with
the getTimer, I can jump to the next scene every
time counting miliseconds...
But when in the last scene I want to put
the REPLAY button, I cannot set the GetTimer to 0,
so the animation jumps to the last scene....
Anybody knows how can I set GetTimer to 0???
Or any Idea about the REPLAY button???
(I cannot use HTML or another SWF!!!)
Thanks!
GetTimer And What Comes After
Ok, I have a ship that drops a mine when you press a key on your keyboard. In the Mine movieclip it waits an allotted amount of time before exploding. What I can't figure out is how to do is make it so you can only drop one mine at a time, and then when the mine explodess, remove the movieclip. This is what I have so far:
function minefire () {
attachMovie("mineLink", "mineDrop", 0);
mineDrop._x = _root.ship._x;
mineDrop._y = _root.ship._y;
timeMineDropped = Math.floor(getTimer()/1000);
if (timeMineDropped > 5) {
A third question is how I would drop the mine behind the ship when it can rotate in any direction.Any ideas? Thanks,
Andy
GetTimer...How Do I?
Prob a simple Q, but how do I set up GetTimer on one frame in my movie, I want it to pause for 3 secs then continue, but don't know the exact code, I don't want to load in another movie clip either. Any help would be great
Thanks
GetTimer Help
Hello,
Having two frames, first frame with circle and second with square.
I want to delay (some seconds) between frames through getTimer AS
Problem is it keeps on looping not going to frame 2.
onClipEvent (load) {
delay = getTimer() + 3000;
trace (getTimer());
}
onClipEvent (enterFrame) {
if (getTimer() >= delay){
gotoAndPlay (2);
trace(getTimer());
}
}
GetTimer()
Wassup,
Does anyone know if there is a way to stop the getTimer() function from counting the elapsed time of the movie? Is there a way to stop the movie and getTimer()?
GetTimer()
I have a problem with the function getTimer()
How can I set it back to 0 while the movie is playing?
Thanks
GetTimer ();
Need help,
Making 1st person shooter ......When the time is up it goes to a gamover screen(this all works),the problem is when you restart the game it goes to the gameover screen,this I think is because the timer function is still running >> how do I stop it at the end of the game then start again at the begining code attcahed.
//TIME MC
onClipEvent (load) {
_root.time=0;
_root.timer=0;
}
onClipEvent (enterFrame) {
timer= getTimer ();
_root.time = (timer / 1000);
if(_root.time >=20)
{
_root.gotoAndStop("gameover");
}
//REstart MC
on (release) {
gotoAndPlay (1);
}
}
Should very simple ans.....thanks
GetTimer ();
I want a timer on my site with the event
on (enterFrame) {
getTimer();
}
I gave that script to a movie clip with a dynamic textfield.
Why can't I see the timer?
GetTimer();
Hi, I can't seem to get the getTimer();
thing working.
Can anybody explain me how I can get this thing working.
I made a movieclip with a dynamic textbox.
I placed the movieclip on the stage and gave it the actionscript
on (enterframe) {
timer.getTimer();
}
And I named the textbox timer.
What am I doing wrong?
Thanks
GetTimer()
Hey flashers, I'm trying to have Flash pause for five seconds before it executes a second block of code on a button. Here's the code I got thus far:
on (press) {
_parent.gotoAndPlay("reverse");
}
on (release) {
pause = getTimer();
if (pause>5000) {
;
}
loadMovie ("NYHsyn.swf", "_level0.container");
_level0.container._x = 36.0;
_level0.container._y = 72.0;
}
Basically what I want to occur is, after a movie clip finishes a reverse a animation which ends on frame 40 of an MC, then, I want the loadmovie action to execute. The reverse animation takes at least five seconds, so I need to pause the second code of execution for five seconds. Thanks for any aid.
GetTimer()
I want a type of screen saver for my project and i was wondering if like i need to use the getTimer command. So it calculates the time gone by, when a certain time goes by it goes to an intro. If this is possible how would i use getTimer.
Im also sure it will be used on a clipevent
GetTimer
I want a type of screen saver for my project and i was wondering if like i need to use the getTimer command. So it calculates the time gone by, when a certain time goes by it goes to an intro. If this is possible how would i use getTimer.
Im also sure it will be used on a clipevent
GetTimer I Don't Know Where I Can Use It
Hi all I am using flash 5 authoring software
suppose that I have a sound
and I have already calculated it's time
for example 16
after counted time I want to subtract that time
from this variable to recount again
how to do it and when we use it
this is the code when it run after that sound
the sound repeated million because of enterFrame event
look my problem that I want to calculate the time
after calculated I want to clean that variable with time
to start counting again that’s all how can I ?
onClipEvent(load) {
i = 1;
mySound = new Sound();
mySound.attachSound("A" + i);
mySound.start();
}
onClipEvent(enterFrame) {
time = getTimer()/1000;
sounder(time);
function sounder (time) {
if(time > 11){
if(i > 2){
i = 0;
}
i++;
mySound.attachSound("A" + i);
mySound.start();
}
}
}
please someone help me my mind blowed (*^*)
GetTimer ();
ok,
I'm trying to learn to use the getTimer Function. with no success.
I want to wait 10secs then play a simple motion tween, where the circle slides off the screen. instead what I get is this:
http://209.41.175.229/neegrita/problems/
as you can see after 9 secs it just moves one frame and does not play the whole tween.
why does it do it after 9 secs (9.9 to be exact) and doesn't play the whole tween?
here's my code on the circleMC (c1):
onClipEvent (enterframe){
waitTime=getTimer ();
if (waitTime > 10000){
_root.c1.gotoAndPlay (2);
}else{
_root.gotoAndPlay (1);
//display milSecs in textbox
_root.displayTime = getTimer();
}
}
for flash 5, thanks!
GetTimer
Peeps, I use the GetTimer script and I put this on frame 200. But when my movie starts and comes at frame 200, the timer that I uses already ahs played 24 seconds or so. But want it to start at 00:00:00
how is this possible?
This is the script at frame 200:
gT = getTimer();min = Math.floor (gT/60000); sec = Math.floor ((gT-min*60000)/1000);mili = gT-min*60000-sec*1000
tijd= (min < 10 ? "0"+min : min ) + " : " + (sec < 10 ? "0"+sec : sec) + " : " + (mili < 10 ? "0"+ mili : mili);minfield = tijd;
GetTimer?
hi
i need to run a different set of action at 15 second intervals but i am unsure what code to use to do so. is is getTimer? or something else? can someone give me a sample piece of code? thanks!
GetTimer() ?
Hi.
I´m creating a system which should contain a multiple set of Timers. I would like to have one on each frame, which should be seperate from the other ones.
The problem I have now is when I start one Timer, goes to another frame and wants to start that timer, it´s already counting since I started it on frame one.
Can this be solved?
Thnxs.
/Petter
GetTimer();
I have around 15-20 movie clips, which I have embedded in a main movie clip. I want to know the time elasped after playing 4 movieclips in the timeline, I want to change the bg sound after the 4th clip. But I am not able to get the total time elasped after playing the 4 movie clips.
I know I can use the getTimer function, but I don't know exactly how can I use it. I have put it on a frame, but it does not show the time anywhere while playing the swf or the .exe projector
I know it is a stupid question, but I need an answer.
Regards,
Vaibhav Kapoor
GetTimer()
I have made a rollover Flash menu for:
http://www.online-mixing.com
The menu works by your mouse rolling over a main section e.g. "Contact" and the submenu pops up above it. I have set a surround box to go around the edge of it so when your mouse moves away from the submenu buttons it goes over this surrounding box. I have set some action script to tell the menu to collapes the submenu when this happens. However l have noticed a bug whereby if you move your mouse really quickly off the menu the flash menu still thinks the mouse it there!
Is there a way that l can set a default time for the submenu to collapse?
Luke
Using GetTimer.
I am trying to create a program to calculate your reaction time.
I want to establish this by using getTimer.
I am not a beginner to AS, but I have just never worked with getTimer.
So.. Is there any information you can tell me about it? How do you use it? How do you start it, stop it, etc? thanks!
GetTimer
I went to have a 5 second countdown on every frame of the root of my movie. What's the easiest way to do this?
GetTimer
want to put a 5 second delay on every frame of my root then have it go to the next one. . What is the best method?
GetTimer
Hi, does anybody have any good examples/tutes using 'getTimer'?
or multiple uses of getTimer- to create multiple timers.
Thanks
GetTimer
Hi, does anybody have any good examples/tutes using 'getTimer'?
or multiple uses of getTimer- to create multiple timers.
Thanks
Two GetTimer()?
Is it possible to have multiple timers and pause only one of them?
Two GetTimer()?
Is it possible to have multiple timers and pause only one of them?
GetTimer
In my movie, I want to depress the mouse button and run certain commands dependent on the amount of time the mouse has been depressed. For example, if the mouse has been depressed for 3 seconds do this and if for 5 seconds do this.
It would appear I would use the getTimer script to determine the amount of time, but how would I write the code? Also, would I need to setup variables in the code?
Any tips to point me in the right direction would be helpful
Thank you,
GetTimer
I'm new to actionScript and I was trying to figure out how to use getTimer. My goal is to display my age in hours, minutes, or seconds. Or some combination of those.
I found this but I think it does not apply to actionScript 3.0
this.onEnterFrame = function() {
var time = new Date();
var hours = time.getHours();
var minutes = time.getMinutes();
var seconds = time.getSeconds();
}
How do I use getTimer in actionScript 3.0? I don't think that will be too hard but I am also unclear on how I would calculate my age based on the information I get from getTimer.
Any Suggestions?
GetTimer
I have a MC with a motion tween inside of it. At the end of the motion tween I have
ActionScript Code:
stop();if (getTimer()>=5000) { gotoAndPlay("stairs");}
Why doesn't this work? It does not wait 5seconds. The scope looks right as well so I'm stumped
Sandman9
As Help With GetTimer
Does anyone Know how to reset time in Flash?
Because i try to make a game where i used getTimer to get the time that a player took to play the game. At the end i display the resurt in a dynamic field, including the length of the game . I've also put a restart button wich allow the user to replay another game. The problem that i'm having is that i can reset the time used by the player. For example if in the first game your time is 1:33 and then you replay the tim does'n t start counting on 0:00 but on 1:33 and then continue.
here is the code
on frame 1;
// a global variable wich will keep the value of the time
_global.tempsFinal = 0;
// get the time while your playing since you started playing
var intervalTime = setInterval(getSecondes, 100);
function getSecondes() {
var my_dateate = new Date();
var econdes:Number = Math.floor(getTimer()/1000)%60;
var minutes:Number = Math.floor((getTimer()/1000)/60);
}
// to display the time in a dynamic field
temps.text = minutes+":"+secondes;
// the code for the button to display the results
ShowResult_btn= function(){
gotoAndStop(10);
tempsFinal = minutes.toString()+":"+secondes.toString();
}
on frame 2
this is the code on the button if you want to restart
restartBtn.onPress = function() {
_global.tempsFinal = 0;
gotoAndStop(1);
}
Does any one knows a better way to do the same task?
thnks
wo1olf
Use Of Gettimer
i wish to know how to use the gettimer to run my on(press) function..
let say i have an array consist of 10 elements, and each element will be called for an interval of 2second.. how can i actually code it out?
i've tried something with this..
for (i=0;i<array.length;i++){
{A=gettimer()
if (gettimer()>2000)
{//run action
}
}
but it doesnt work..
GetTimer
I have a MC with a motion tween inside of it. At the end of the motion tween I have
ActionScript Code:
stop();if (getTimer()>=5000) { gotoAndPlay("stairs");}
Why doesn't this work? It does not wait 5seconds. The scope looks right as well so I'm stumped
Sandman9
GetTimer
If I've got a movie which loads another movie into it, is there a way I can use the getTimer command but only in the loaded movie.
What I mean is if I just use it as normal, it counts the seconds since the whole of the movie started. How can I make it specific to the one I loaded?
I want it to count ten seconds before it carries on, but if the movie is in a loop, 10 seconds is only going to happen once, so when it gets back round to this point, it'll never carry on.
Thanks
GetTimer()
I am working on Scene 1 and scene 2 in my Flash file. When I click on a button to go to Scene 2, it does not stop on (Scene 2, frame 1), Instead it plays the whole movie (frame labelled "hand"), as per the onEnterFrame function below.
ActionScript Code:
_root.onEnterFrame = function() {
if (getTimer()>10000) {
_root.gotoAndStop("hand");
}
};
Is there any other simple way to make use of the getTimer (with an Enterframe function, if necessary) but the movie stops on (Scene 1, frame1), waits for 10 seconds and then go to frame "hand"
Thanks
What Exactly Is GetTimer()?
I understand what getTimer does (I often use it), but what is it? How does it fit into AS 3.0's OOP framework? It's not just a toplevel function, like trace(). You have to import it:
import flash.utils.getTimer;
But then you use it without any qualifying class reference. It's not SomeClass.getTimer(). It's just getTimer(). So somehow you're importing a function, not a class. I didn't think you could do this. Can you? Can you make your own importable functions (without using includes)? Or is this just a weird, built-in exception. There's certainly no file on my system called getTimer.as.
GetTimer() PC And MAC
on my PC the getTimer function can update as fast as the frame rate of the main flash movie, however on a mac the getTimer function seems to only update every 6 or 7 seconds.
heres the code:
onClipEvent (load) {
_root.accrualRatePerSecond = 9.93;
_root.StartAmount = 533330009;
_root.DateYear = 2003;
_root.DateMonth = 11;
_root.DateDay = 30;
currentDate = new Date();
thisYear = currentDate.getFullYear();
eventDate = new Date(_root.DateYear, (_root.DateMonth-1), _root.DateDay);
eventMillisecs = eventDate.getTime();
}
onClipEvent (enterFrame) {
currentDate = new Date();
currentMillisecs = currentDate.getTime();
trace(currentMillisecs);
this.msecs = (eventMillisecs-currentMillisecs)*-1;
CurrentAmount = (this.msecs*(9.93/1000));
CurrentAmount = int(_root.StartAmount+CurrentAmount);
CurrentAmount = CurrentAmount.toString();
_root.amountMain = CurrentAmount;
}
Pretty simple really works fine on a PC but on a mac the timer dosnt update as fast as the framerate... is there a workaround?
Thanks
Rez
Reseting GetTimer
Has anyone had any experience with reseting the getTimer()
object back to "0" ? I'm working on a timed piece where
movie clips and files are activated only at a specific time.
The major problem is....when the file loops to play again,
the file plays through without a timer. Nothing stays synched !! I tried to reload a projecter after quitting the current file, I've also tried reloading the .swf file into
_level0 to restart. I'm running out of options. Any help would be greatly appreciated! THaNk YoU!
Odd GetTimer() Behavior
I'm using getTimer() in a function to create a 3 second delay before proceeding to the next frame. Prior to the delay, I'm attempting to move a Movie Clip along the x axis. When I execute the code in the standalone player, I see the Movie Clip's new position after the delay code has ran. I'm still kind of new to Flash, so maybe I'm just missing something.
I've wasted about a day now rewriting this code. Does anyone have a suggestion? Any help is greatly appreciated.
Here's my code:
function display() {
if (x == 0) {
//MOVE CLIP;
movieClip._x = 400;
//PAUSE IS HAPPENING BEFORE MOVIE CLIP'S NEW POSITION
//IS DISPLAYED
start = getTimer();
while (start + 3000 > now) {
now = getTimer();
}
}
Thanks for looking.
Reset GetTimer() ?
Hi,
I'm using the getTimer function on about frame 5 of my movie but it seems to start on about 3 secs because of this. Is there any way to reset the function to zero?
Thanks.
GetTimer Questions
I'm trying to use getTimer so I can move from one frame to the next frame in a movie clip instance after 15 seconds, but i've been unsuccesfull in my attempts. Can someone post or direct me to a tutorial on how to use getTimer in this type of script?
Controling GetTimer() ---------- HELP
Is there a way to start and stop this function at will.
I have it on the second frame of my movie with a stop on the first frame. I want this timer to start when the user gets to the second frame. The way it works now is that if the user is on the first frame for 20 second, the timer will start at 20 seconds.
Help - Stoping GetTimer()
Hi there,
This is probably a really easy question for many people but it has me stuck.
When the file is loaded (i.e. percent == "100%")
I want to stop the getTimer function so I can tell how long the file too to load.
Any idea's?
onClipEvent (load) {
total = Math.round(_root.getBytesTotal()/1000);
total = total+"k"+"//";
}
onClipEvent (enterFrame) {
seconds = (getTimer()/1000);
download = Math.round(_root.getBytesLoaded()/1000);
download = download+"k";
bytesleft = Math.round(_root.getBytesTotal()-_root.getBytesLoaded()/1000);
bytesleft = bytesleft+"k";
percent = Math.round(_root.getBytesLoaded()/_root.getBytesTotal()*100);
percent = percent+"%";
// loadVariables ("test.txt", "mtv_txt");
// percent = percent + "//";
// loadingone = "total file size=" + total + "k" + "//" + "downloaded=" + download + "k";
// loadingtwo = "percentage=" + percent + "//" + "kilobytes remaining=" + bytesleft + "k";
if (percent == "100%") {
_root.gotoAndplay(2);
}
Cheers,
Sean.
}
|