hi Everyone..!
I made a timer which includes a movie clips and a button. although it works
firstly well, but i did not pause it. Fallowing are my codes:
------------movie_Clip-----------:
frame1;
control=0;
frame2:
var mytime:Date=new Date();
zaman=mytime.getTime();
if(control==0)
{
zaman_bas=zaman;
control=1;
}
_root.mytimebox=int(zaman-zaman_bas)/1000;
frame3;
gotoAndPlay(2);
-----------------------------Button------------------------------
on(press)
{
timeC_mc.gotoAndStop(1);
time_ins=_root.mytimebox;
trace(time_ins);
}
on(release)
{
timeC_mc.gotoAndPlay(2);
_root.mytimebox=time_ins
}
kglad - 30 Nov 2005 16:07 GMT
i'm not sure what you're trying to do, but i'm sure there are better ways to do
it. in addition, if you don't want to reset your timer you should use the
following attached to your button:
on(press)
{
timeC_mc.gotoAndStop(2);
time_ins=_root.mytimebox;
trace(time_ins);
}
on(release)
{
timeC_mc.gotoAndPlay(2);
_root.mytimebox=time_ins
}
cagabo - 30 Nov 2005 16:17 GMT
Originally posted by: kglad
i'm not sure what you're trying to do, but i'm sure there are better ways to
do it. in addition, if you don't want to reset your timer you should use the
following attached to your button:
on(press)
{
timeC_mc.gotoAndStop(2);
time_ins=_root.mytimebox;
trace(time_ins);
}
on(release)
{
timeC_mc.gotoAndPlay(2);
_root.mytimebox=time_ins
}
My dear friends..!
what i m trying to do is to pause my timer. but i don't know how ? figure out
this problem.
kglad - 30 Nov 2005 16:31 GMT
in frame 1 of a 2 frame movieclip you can use:
if (!pauseDef) {
pauseDef = 1;
pauseTime = 0;
}
trace(Math.round((getTimer()-pauseTime)/1000)+" "+pauseTime);
btn1.onPress = function() {
stopTime = getTimer();
_root.stop();
};
btn1.onRelease = function() {
_root.pauseTime += getTimer()-stopTime;
_root.play();
};
cagabo - 30 Nov 2005 20:15 GMT
thank you very much..! my firend
kglad - 30 Nov 2005 20:50 GMT