A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: How to Add Time Left to Final Score

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    3

    How to Add Time Left to Final Score

    Hey, can someone help this is killing me.

    I have a score that goes up by 10 every time you press this button, its var "score".

    I have a simple countdown timer. caller, its var "timer".

    When the game ends it goes to the next frame which says game end. I can get the score to show but I want the time left to be added to this.

    I am kind of new to this.

    I have tired

    onEnterFrame (){
    score = Number(score) + timer;
    }

    Nothing seems to work

    Do I even actually use onEnterFrame ?

  2. #2
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Don't use onEnterFrame (though, you use it like this: onEnterFrame = function(){), because it's a loop, and it will keep executing those codes. What I'd do, would do the same, just without the onEnterFrame
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  3. #3
    Junior Member
    Join Date
    Aug 2011
    Posts
    3
    I tried putting this in the final frame

    score = Number(score) + 25;


    I know the above works with a button "onRelease" function but it does not seem to work when the timeline gets to the final frame.

    Don't I need some code that states when the timeline gets to the final frame or will the code only execute on the final frame if the code is on that frame itself?

  4. #4
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    That code will be executed, first and only once, when it first appears. So yeah, it needs to be on the Last Frame!
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

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