Timer + round

I’m stupid!
I can’t do anything right so I thought what the hell I’ll ask it at kirupa.com …AGAIN…

OK the Timer
The movie stops at frame 1 for 3 seconds and then goes to frame 2.
(No textboxes that show the time that has passed or something… just the timer to count the seconds… or something…)

I have a textbox var-named “tb” and I typed there “10.22222”. I want it to round the thing to 10.22

Geezuz I’m asking the same things I’ve asked before…
Like I said I’m stupid :slight_smile:

You can try that trick :
you multiply by 100, floor it, and then divide by 100.
Something like Math.floor (var*100)/100.
It should do.

pom 0]

And what does that supposed to do?
I mean it does nothing. It just multiplies it by 100 and then divides it by 100 and the result logically is the same. I tried it out and there it is the same too.

Are you sure about that ??? :wink: Try with (Math.floor(var*100))/100 ;
pom 0]

What does it do, do you ask ? Simple : let’s say you have
var = 1.23456789 ;
var100 = 123.456789
Math.floor (var
100) = 123
Divide it by 100 = 1.23
What you wanted, isn’t it ??

There ! Put any two numbers, but try and make so that their division won’t be an integer. For instance 1 and 7, 2 and 9… Whaddya think ?

pom 0]

Hey! That works!
It’s not rounding I mean if my number is 12.479 the rounded one should be 12.48 but that only makes it 12.47…
But it’ll do…
------No there’s one thing left: The timer :eek: -------

I don’t understand your problem with the timer.Can you explain it a little bit better ?
And concerning the rounding, making it so that it really rounds things would be, in my method, very disgraceful but there’s a way. There always is.

pom 0]

to round, change Math.floor to Math.round

I tried that. It didn’t seem to work. It looked pretty obvious… Maybe I used the “uncut” numbers ?

pom 0]

This is driving me grazy! :mad:
I made a movie where that roudning thing worked and I didn’t save it now I was gonna try change it Math.round and I made another movie but that’s not working… I think the problem’s in the action’s locaton…
Where should I put it (on a keyframe/on a btn…) I can’t remember where I put it before…
--------The timer—
For example the movie plays and …lets say… in frame 50 I want it to stop for 3 seconds and then play on.
I don’t want any textboxes that show the time or something just to start the timer and if the timer reaches 3 seconds play();

Don’t get GRAZY !! It’s probably just a problem of path. Relax, leave your comp and get back to it in an hour.
About the timer, there’s a wonderphul script by… guess who ??? Dans le mille, Emile ! Suprabeener about that. Exactl what you want, and very well explained too.
Here : www.multimania.com/ilyaslamasse/timer/
Take the fla.

pom 0]

Ok but I don’t really understand that script exactly…
that’s the thing with the textboxes showing time and stuff and I can’t take the time-showing script from the timer script apart so… That doesn’t make sense to me at all…
In frame 39 there s pause(5);
If I delete that it doesn’t make a pause there ok but if I delete script in frame 1 then it doesn’t pause either. These things are connected to each other …somehow… I can’t understand the script there…

Yeah, that’s one though script indeed. But you are told how to use it, so…
Anyway, here’s a little explanation, and if I’m wrong, Supra can come here and quick my ass…

In the main timeline :

MovieClip.prototype.pause = function(l){
&nbsp &nbsp &nbsp &nbsp stop();
&nbsp &nbsp &nbsp &nbsp attachMovie("timer","timer1",76);
&nbsp &nbsp &nbsp &nbsp timer1.init = getTimer();
&nbsp &nbsp &nbsp &nbsp timer1.l = l;

He likes that prototype thing… Supra, I mean. Very disconcerting when you’ve never seen anything like that. Anyway, what it means is : a movie clip can call that function, with an argument * l* which is the pause.
The movie stops.
You put an instance of the movie clip * timer*, aka * pause* and you name it * timer1*, on level 76 (not so important).
Tou initialize the value * init* and * l* INSIDE THIS CLIP you’ve just created.

In the clip “pause” :

&nbsp &nbsp &nbsp &nbsp time = getTimer()-_parent.init;
&nbsp &nbsp &nbsp &nbsp if((getTimer()-_parent.init)/1000>_parent.l){
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _parent._parent.play();
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _parent.removeMovieClip();
&nbsp &nbsp &nbsp &nbsp }

Now, what do we have ? The part :

timer1.init = getTimer();

made the clip * timer1* get the time (getTimer ()) when it is launched. Here, the line :

time = getTimer()-_parent.init;

gets the number of milliseconds that have passed since the init. If this time/1000 (to turn it into seconds) is superior to the time span of the pause * _parent.l*, you tell the movie to play, and you remove the pause clip.
All those * _parent.parent* things are a little bit difficult to grasp, but draw your situation on a sheet of paper, and it all becomes clear (hum…).

I hope you understand it better now.

pom 0]

huh… looking at that little script i feel like a total loser!
ok would you please tell me how would you do a thing like…
in frame 1-> wait 3 seconds and gotoAndStop(2);
how would you do that…
I still havent totally understood the script there…

Still can’t understand it fully…

Hey, man everything is explained in the fla !! Just put the code pause (2); in the frame you want to pause (after you’ve exported the pause movie, of course).
pom 0]