A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [help] Timer Question, Is there another way?

  1. #1
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874

    [help] Timer Question, Is there another way?

    I am creating a timer using a dynamic text box, is there a way to tell my timer to plus 1 every second with out having to refer the frame rate?

    i was using the following untill i realised it was affected by frame rate...

    on the frame one i have
    Code:
    _root.mils = 0;
    _root.secs = 0;
    and in a empty MC i have the following controls
    Code:
    onClipEvent (enterFrame) {
                 _root.sec.text = _root.secs;
                 _toot.mil.text = _root.mils
    }
    onClipEvent (enterFrame) {
    	_root.mils+= 1;
    }
    onClipEvent (enterFrame) {
    	if (_root.mils== 10) {
    		_root.mils= 0;
    		_root.secs += 1;
    	}
    }
    Can i do the following without having to worry about the frame rate
    92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!

  2. #2
    Avoiding the real world. NeedleInMySpine's Avatar
    Join Date
    May 2005
    Location
    Canada
    Posts
    188
    I made this timmer diffrently.
    on the first frame:
    code:
    zeero = int(getTimer()/1000);


    on the second frame:
    code:
    Time = 60
    if(Number(Time) >0)
    {
    display = (Math.round(getTimer()/1000))- zeero;
    Time = 60 - display
    }

    if(Number(Time) == 0)
    {
    _root.gotoAndPlay ("gameOver");
    }


    and on the third frame:
    code:
    gotoAndPlay("loopstart");



    I think youll be able to modifie that to do what you need. Every thing is in a MC with a dynamic text box with the variable name display and one with the name time.
    Knowledge is power, power corrupts, study hard, be evil.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center